{
  "format": "nodecrypto",
  "formatVersion": 1,
  "protection": "public",
  "manifest": {
    "label": "cmac-subkey",
    "version": "1",
    "description": "RFC 4493 CMAC subkeys K1/K2: AES-128-ECB(key, 0^128) -> built-in script (builtin-script.md §12.1)",
    "category": "",
    "inputs": [],
    "outputs": []
  },
  "requires": [],
  "workflow": {
    "name": "cmac-subkey",
    "description": "RFC 4493 CMAC subkeys K1/K2: AES-128-ECB(key, 0^128) -> built-in script (builtin-script.md §12.1)",
    "viewport": {
      "x": 0,
      "y": 0,
      "zoom": 1
    },
    "nodes": [
      {
        "id": "node-1791034725443-vjew",
        "type": "cryptoNode",
        "position": {
          "x": 0,
          "y": 0
        },
        "data": {
          "id": "node-1791034725443-vjew",
          "type": "cryptoNode",
          "nodeType": "input-static-value",
          "label": "Key",
          "category": "input",
          "description": "Provides a constant value of a user-selected type (bytes/string/int/bool)",
          "inputs": [],
          "outputs": [
            {
              "id": "value",
              "name": "Value",
              "dataType": "bytes",
              "description": "Constant value of the selected type"
            }
          ],
          "size": "small",
          "properties": {
            "type": "bytes",
            "valueBytes": "2b7e151628aed2a6abf7158809cf4f3c",
            "valueString": "Hello NodeCrypto!",
            "valueInt": 0,
            "valueBool": false
          }
        },
        "selected": false
      },
      {
        "id": "node-1791034725443-thzy",
        "type": "cryptoNode",
        "position": {
          "x": 0,
          "y": 224
        },
        "data": {
          "id": "node-1791034725443-thzy",
          "type": "cryptoNode",
          "nodeType": "input-static-value",
          "label": "Zero block",
          "category": "input",
          "description": "Provides a constant value of a user-selected type (bytes/string/int/bool)",
          "inputs": [],
          "outputs": [
            {
              "id": "value",
              "name": "Value",
              "dataType": "bytes",
              "description": "Constant value of the selected type"
            }
          ],
          "size": "small",
          "properties": {
            "type": "bytes",
            "valueBytes": "00000000000000000000000000000000",
            "valueString": "Hello NodeCrypto!",
            "valueInt": 0,
            "valueBool": false
          }
        },
        "selected": false
      },
      {
        "id": "node-1791034725444-0rm7",
        "type": "cryptoNode",
        "position": {
          "x": 336,
          "y": 64
        },
        "data": {
          "id": "node-1791034725444-0rm7",
          "type": "cryptoNode",
          "nodeType": "symmetric-aes-encrypt",
          "label": "AES-128-ECB",
          "category": "symmetric",
          "description": "Encrypts plaintext using NIST AES (128/192/256-bit)",
          "inputs": [
            {
              "id": "plaintext",
              "name": "Plaintext",
              "dataType": "bytes",
              "required": true
            },
            {
              "id": "key",
              "name": "Key",
              "spec": "16/24/32B",
              "dataType": "bytes",
              "required": true,
              "description": "AES symmetric key. Length selects AES-128/192/256."
            },
            {
              "id": "iv",
              "name": "IV",
              "spec": "16B",
              "dataType": "bytes",
              "required": false,
              "description": "Initialization vector/counter/tweak (16B). Defaults to 16 zero bytes if omitted."
            },
            {
              "id": "nonce",
              "name": "Nonce",
              "spec": "12B",
              "dataType": "bytes",
              "required": false,
              "description": "AEAD nonce (12B), used only in GCM/CCM mode. Defaults to 12 zero bytes if omitted."
            },
            {
              "id": "aad",
              "name": "AAD",
              "spec": "GCM/CCM only",
              "dataType": "bytes",
              "required": false,
              "description": "Additional Authenticated Data, used only in GCM/CCM mode."
            }
          ],
          "outputs": [
            {
              "id": "ciphertext",
              "name": "Ciphertext",
              "dataType": "bytes"
            },
            {
              "id": "tag",
              "name": "Auth Tag",
              "spec": "GCM/CCM",
              "dataType": "bytes",
              "description": "Authentication tag produced in GCM/CCM mode."
            }
          ],
          "properties": {
            "mode": "ECB",
            "padding": "None",
            "errorUnify": false,
            "errorUnifyCode": "",
            "errorUnifyMessage": ""
          }
        },
        "selected": false
      },
      {
        "id": "node-1791034725445-1efh",
        "type": "cryptoNode",
        "position": {
          "x": 720,
          "y": 64
        },
        "data": {
          "id": "node-1791034725445-1efh",
          "type": "cryptoNode",
          "nodeType": "utility-script",
          "label": "CMAC subkeys",
          "category": "utility",
          "description": "Runs a built-in script (Python subset) over bytes/int/bool/string ports",
          "inputs": [
            {
              "id": "l",
              "name": "l",
              "dataType": "bytes",
              "required": true
            }
          ],
          "outputs": [
            {
              "id": "k1",
              "name": "k1",
              "dataType": "bytes"
            },
            {
              "id": "k2",
              "name": "k2",
              "dataType": "bytes",
              "required": true
            }
          ],
          "size": "basic",
          "dynamicInputs": {
            "min": 0,
            "defaultNamePrefix": "in",
            "defaultDataType": "bytes"
          },
          "dynamicOutputs": {
            "min": 1,
            "defaultNamePrefix": "out",
            "defaultDataType": "bytes"
          },
          "properties": {
            "code": "def dbl(x: bytes) -> bytes:\n    rb = h\"00\" * (len(x) - 1) + (h\"87\" if len(x) == 16 else h\"1b\")\n    r = x << 1\n    if x[0] & 0x80 != 0:\n        r ^= rb\n    return r\n\nk1 = dbl(l)\nk2 = dbl(k1)\n",
            "scriptVersion": 1,
            "errorUnify": false,
            "errorUnifyCode": "",
            "errorUnifyMessage": ""
          }
        },
        "selected": false
      }
    ],
    "edges": [
      {
        "source": "node-1791034725443-thzy",
        "sourceHandle": "value",
        "target": "node-1791034725444-0rm7",
        "targetHandle": "plaintext",
        "animated": true,
        "style": {
          "stroke": "#3b82f6",
          "strokeWidth": 2
        },
        "id": "xy-edge__node-1791034725443-thzyvalue-node-1791034725444-0rm7plaintext"
      },
      {
        "source": "node-1791034725443-vjew",
        "sourceHandle": "value",
        "target": "node-1791034725444-0rm7",
        "targetHandle": "key",
        "animated": true,
        "style": {
          "stroke": "#3b82f6",
          "strokeWidth": 2
        },
        "id": "xy-edge__node-1791034725443-vjewvalue-node-1791034725444-0rm7key"
      },
      {
        "source": "node-1791034725444-0rm7",
        "sourceHandle": "ciphertext",
        "target": "node-1791034725445-1efh",
        "targetHandle": "l",
        "animated": true,
        "style": {
          "stroke": "#3b82f6",
          "strokeWidth": 2
        },
        "id": "xy-edge__node-1791034725444-0rm7ciphertext-node-1791034725445-1efhl"
      }
    ]
  },
  "definitions": {}
}
