ComfyUI Node

Bits Counter

The Two-Second Check Before Your AES Blows Up

By AzelusLightvale·Created 12 months ago·Updated 5 days ago· 1
Bits Counter
  • text
  • STRING

BitsCounter is a one-line utility that answers one question: how many bits is this bytes-like object? Feed it any BYTESLIKE value, and it returns the bit length as a string - the source comment says it was "meant for use with AES, but can be used with anything of the byteslike type," and that's exactly the right way to think about it. It's not a cipher, it's not a converter; it's a sanity check.

Why would you ever need this in ComfyUI? Because the pack's modern crypto nodes are picky about sizes in ways that aren't visible on the canvas. A Fernet key is 32 bytes (256 bits), an AES-128 key is 16 bytes (128 bits), an AES nonce wants 12 bytes (96 bits), and a key-wrap key must be a multiple of 8 bytes. When a decrypt fails with a length error, the fastest diagnosis is to run the suspect value through this node and see what you're actually holding. In a graph where everything is dark gray BYTESLIKE wires, a bit count is the one number that tells you whether your key is even the right size to be your key.

The input and output

  • text (BYTESLIKE) - the only input. Feed it any bytes from a keygen node, ByteslikeEncode, SystemRandom, or a decrypt output.
  • Output - the bit count (len × 8) as a STRING. Note that the pack returns it as text, not an integer - if you need to feed it into a numeric port, you'll be converting, not plugging straight in.

That's the entire node. There is no configuration, no second mode, nothing to tune. It's the utility version of looking at your hands before you cross the road.

Where people get burned

The one trap is the type. The input is BYTESLIKE, not a text field, so you can't type "abc" into it and get 24 - you have to feed it an actual bytes-like object (which is the whole point: it's measuring the real thing, not a string). And the output being a STRING surprises people who expected a number; if your next node wants an INT, do the conversion yourself.

Honestly, there's not much more to say about this node - and that's fine. Some nodes exist to be workhorses, and a tool that answers "how big is this?" in one step earns its place next to the keygens and nonce generators it was built to check.

Installing it

It ships with the ARG Toolkit pack:

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

Restart ComfyUI and it's under ARG Toolkit → Utilities (or install via ComfyUI Manager → search "ComfyUI ARG Toolkit"). Pure Python, no extra dependencies, no models, nothing heavy.

Troubleshooting

  • Won't accept my text → the input is BYTESLIKE; run your text through ByteslikeEncode first, or feed it from a keygen/random node.
  • Output won't feed a numeric port → it's a STRING by design; convert as needed.
  • Feels too simple → that's the point. When your AES node rejects a key, the 30-second bit check here beats ten minutes of guessing.

BitsCounter is the node you'll use rarely and be glad exists - the kind of tiny diagnostic that keeps a complex pack usable. Reach for it the first time a modern crypto node tells you something is the wrong size.

CategoryARG Toolkit/Utilities

Inputs (1)

NameTypeDefaultDescription
textBYTESLIKE

Outputs (1)

NameTypeDescription
STRINGSTRING