viewof capInput = Inputs.text({
label: "Capability hex value (e.g. 0x0007)",
value: "0x0007",
placeholder: "0x0000 - 0xFFFF"
})
{
const flags = [
{bit: 0x0001, name: "READ", desc: "Read sensor data"},
{bit: 0x0002, name: "WRITE", desc: "Write configuration"},
{bit: 0x0004, name: "EXECUTE", desc: "Execute commands"},
{bit: 0x0008, name: "DELETE", desc: "Delete records"},
{bit: 0x0010, name: "CREATE", desc: "Create new resources"},
{bit: 0x0020, name: "ADMIN_READ", desc: "Read admin data"},
{bit: 0x0040, name: "ADMIN_WRITE", desc: "Write admin config"},
{bit: 0x0080, name: "GRANT", desc: "Grant permissions"},
{bit: 0x0100, name: "REVOKE", desc: "Revoke permissions"},
{bit: 0x0200, name: "AUDIT", desc: "Access audit logs"},
{bit: 0x0400, name: "EMERGENCY", desc: "Emergency override"},
{bit: 0x0800, name: "DEBUG", desc: "Debug/diagnostic access"}
];
const val = parseInt(capInput.replace(/^0x/i, ""), 16) || 0;
const clamped = val & 0xFFFF;
const binary = clamped.toString(2).padStart(16, "0");
const rows = flags.map(f => {
const has = (clamped & f.bit) !== 0;
return `<tr style="background:${has ? "#e8f5e9" : "#ffebee"}">
<td style="padding:4px 8px;font-family:monospace">0x${f.bit.toString(16).padStart(4,"0").toUpperCase()}</td>
<td style="padding:4px 8px;font-weight:bold">${f.name}</td>
<td style="padding:4px 8px">${f.desc}</td>
<td style="padding:4px 8px;text-align:center">${has ? "GRANTED" : "DENIED"}</td>
</tr>`;
}).join("");
const granted = flags.filter(f => (clamped & f.bit) !== 0).length;
return html`<div style="font-family:sans-serif">
<p><strong>Decimal:</strong> ${clamped} | <strong>Binary:</strong> <code>${binary}</code> | <strong>Granted:</strong> ${granted}/12 capabilities</p>
<table style="border-collapse:collapse;width:100%;font-size:0.9em">
<tr style="background:#2C3E50;color:white">
<th style="padding:6px 8px;text-align:left">Flag</th>
<th style="padding:6px 8px;text-align:left">Name</th>
<th style="padding:6px 8px;text-align:left">Description</th>
<th style="padding:6px 8px;text-align:center">Status</th>
</tr>
${rows}
</table>
</div>`;
}Interactive Capability Explorer
Interactive Capability Explorer
animation
authentication
security
Try Change the capability hex value from 0x0007 to 0x0001.
Observe Watch Granted and Status after you press Calculate permissions.
Explain Describe how bit flags determine Status when you press Calculate permissions.
Technical boundaries. The calculator masks the input to 16 bits and displays 12 defined capability flags. An input that cannot be parsed becomes 0.
Interactive Capability Explorer
Use the calculator below to see which permissions a given capability value grants. Enter a hexadecimal capability value to decode its bit flags. Hexadecimal is a base-16 number written with digits 0-9 and letters A-F: