X963KDF Key Verification
The 'is this the right key?' node — constant-time key checking, minus the suspense
- message
- expected_key
- info
- verified_status
If you've built a workflow around the pack's X963KDF_Derive node, at some point you'll want to answer one boring but crucial question: is this the key I expect, or did the shared secret get corrupted somewhere? That's this node. It re-derives a key with the exact same parameters and compares it to your expected key - and it does the comparison in constant time, which is the difference between a check you can use in crypto code and a check that leaks timing info. It's a Verify node in the ComfyUI ARG Toolkit's Modern Cryptography section, powered by the cryptography library's X963KDF.
Let me be precise about what "verify" means here, because the name is easy to over-read. It does not verify a signature or a decryption. It derives a key from the same message/length/algorithm/info you fed into X963KDF_Derive, compares the result to expected_key, and returns whether they match. It's a round-trip integrity check - handy for confirming that both sides of an exchange computed the same shared key, or that a stored key survived a trip through the pack's encoders and back.
The inputs mirror X963KDF_Derive almost exactly:
- message - the original shared secret (
BYTESLIKE), the same bytes you derived from the first time. - length - the derived key length in bytes. It must match the original derivation, or the check fails even with the right message. Default 32.
- algorithm - the hash function used originally. Same dropdown of 15 options, and again it must match.
- info - optional context bytes; leave empty if you left it empty the first time.
- expected_key - the
BYTESLIKEkey you're checking against. Feed this fromX963KDF_Derive'sderived_keyoutput, or from a decoded bytes source.
Output is a single verified_status boolean - true if the re-derived key matches the expected key, false otherwise. Under the hood it calls the KDF's constant-time verify method and catches the InvalidKey exception to produce the false, so a mismatch is an ordinary output rather than a workflow-killing error.
One behavior worth knowing: the underlying KDF target can only be finalized once, and the code explicitly raises a RuntimeError if the verify function somehow gets called twice on a finalized target. In normal usage - one derive, one verify, separate targets - you'll never see it, but if you're looping nodes aggressively, don't try to reuse a single verify call as a perpetual check.
Because everything is BYTESLIKE, the same rule as its sibling applies: you can't type bytes into the boxes. Wire message and expected_key from actual bytes-producing nodes (XExchange's shared_key, X963KDF_Derive's derived_key, or ByteslikeEncode for literals). That's not a bug - it's the pack's custom wire type doing its job.
Install is the pack standard: ComfyUI Manager → search "ComfyUI ARG Toolkit" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
# restart ComfyUI
It's a small, one-author GPLv3 pack whose README is upfront that it started as an amateur project with tests only covering common cases - so modern-crypto nodes like this one are the places to poke before you trust them with anything real. This one's a thin wrapper over a well-tested library, and the behavior matches the tooltips. For learning how X9.63 KDF verification works, or for a self-check inside an ARG pipeline, it's perfectly fine.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| length | INT | 3216–256 | The desired length of the derived key in bytes. |
| message | BYTESLIKE | The message to derive key from. Must be bytes. | |
| algorithm | COMBO | The algorithm to use for hash generation. | |
| expected_key | BYTESLIKE | The expected result of key derivation. | |
| infoopt | BYTESLIKE | Application-specific context information. If left empty, will pass an empty byte string. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| verified_status | BOOLEAN | — |