Nodes/ComfyUI ARG Toolkit/SHAKE XOF Hashing
ComfyUI Node

SHAKE XOF Hashing

Squeeze the exact bytes you want out of SHAKE

By AzelusLightvale·Created 12 months ago·Updated 2 days ago· 1
SHAKE XOF Hashing
  • key
  • hash_bytes
squeeze_bytes16
digest_size32
algorithm

XOFSHAKE ("SHAKE XOF Hashing") is the streaming sibling of the pack's SHAKE Hashing node, and it's the more correct way to use SHAKE. SHAKE128 and SHAKE256 are extendable-output functions from the SHA-3 family - the "XOF" in the name - which means the output is a stream you can pull from, not a fixed-size result. HashSHAKE behaves like a normal hash: you declare an output length and get it in one shot. XOFSHAKE instead separates the two knobs: digest_size sets the algorithm's security parameter, and squeeze_bytes is how many bytes you actually pull out.

Why bother having both? For most jobs the one-shot node is fine. But when you want a specific number of bytes - a 16-byte AES-128 key, say - the XOF form is the honest way to ask for it, with the output length decoupled from the hash's strength setting. Same deterministic property as HashSHAKE: identical input produces identical bytes, every run.

The inputs

  • key (BYTESLIKE, mandatory) - like every socket in this pack's crypto section it's forceInput, so you can't type into it. Convert a string with the pack's Bytes-like Object Encode node first.
  • algorithm - SHAKE128 or SHAKE256. 128-bit vs 256-bit security; the same trade-off as in the non-XOF node.
  • digest_size (default 32, min 1) - the algorithm's strength parameter, still required by the underlying library.
  • squeeze_bytes (default 16) - the amount of bytes to squeeze, i.e. the actual length of what you get back.

What comes out

One output, hash_bytes (BYTESLIKE) - raw bytes again. To read them as text, run them through the pack's Bytes-like Object Decode and pick Hexadecimal or Base64. To use them as a key, wire the bytes straight into another ARG Toolkit node; the whole pack talks BYTESLIKE.

A quick note on defaults: 16 squeezed bytes is a nice AES-128 key size, and 32 bytes matches SHA-256's output if you want something familiar. The algorithm dropdown's default isn't actually wired in the source (a misspelled key in the node definition), but it lands on SHAKE128 anyway since that's first in the list - cosmetic, not a bug.

Installing it

Same path as every node in this pack. ComfyUI Manager: search "ComfyUI ARG Toolkit". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit

Then restart ComfyUI. It's a light node in a heavier pack: the install pulls cryptography, secretpy, stegano, reedsolo, and friends, and its autogenerated requirements.txt pins exact torch, numpy, and opencv-python versions. If pip tries to touch your existing torch install, that file is where the trouble starts.

Troubleshooting

  • Hash you can't read - it's bytes, not text. Decode via Bytes-like Object Decode with Hexadecimal selected.
  • "Expected bytes-like objects" - something on the key socket isn't BYTESLIKE. Encode your string first.
  • Looking for the node and can't find it - it's under ARG Toolkit/Cryptography/Modern/Hashing, right next to its SHAKE sibling. If it's missing entirely, the pack isn't installed; grab it with Manager.
CategoryARG Toolkit/Cryptography/Modern/Hashing

Inputs (4)

NameTypeDefaultDescription
keyBYTESLIKEFirst key (mandatory)
squeeze_bytesINT16The amount of bytes to squeeze.
digest_sizeINT32The length of output desired (in bytes)
algorithmCOMBOThe algorithm for hashing.

Outputs (1)

NameTypeDescription
hash_bytesBYTESLIKE