String to MD5
Turn any prompt or string into a stable fingerprint
- md5_hash
What it is
StringToMD5 takes any text - a prompt, a negative prompt, a settings blob - and hands you back a fixed 32-character hex string. Same input, same hash, every time, on any machine. It's one of those dumb-simple nodes you don't think you need until you have a reason, and then you're glad it exists.
The pack it lives in, ComfyUI_md5, is three tiny hash utilities for string, file, and image. This is the string one, and honestly the one you'll use most.
Why you'd reach for it
The stable, short fingerprint is the whole product. Practical uses:
- Prove two runs used the same prompt. Paste the prompt into a text log alongside the hash, and later you can confirm "yes, this run really did use prompt X" without re-reading a wall of text.
- A/B testing without ambiguity. Hash the prompt at the start of each branch; when the hashes differ, so did the text.
- Deterministic IDs. Hash a config string and use the digest as a cache key or a filename fragment in automation. It's a compact, collision-resistant-enough identifier for that job.
- Dedup. If your automation feeds the same text in twice, the hash tells you instantly.
How it works
The node encodes the string as UTF-8 bytes and runs them through Python's hashlib.md5. Nothing exotic. It's a pure computation - no network, no files, no model. That also means it's fully deterministic, which is the entire point.
Because it's an output node, ComfyUI treats it as a terminal - but the md5_hash STRING output still wires into anything else that accepts a string: text display nodes, filename builders, logging nodes. Hash it and pipe it somewhere.
Inputs and outputs
- input_string (STRING, multiline) - the text to hash. Multiline matters: it's meant to swallow a whole prompt, not just a single word.
- case (enum, default
lower) -lowerorupper, cosmetic. Conventional hashes are lowercase, but flip it if something downstream expects uppercase. - md5_hash (STRING, output) - the 32-character hex digest.
The one thing that will trip you up
The hash is over the exact bytes, so whitespace counts. "hello" and "hello " produce different hashes. A trailing newline from pasting a prompt - which happens constantly with multiline input - silently changes the result. If your hash doesn't match a reference, check for invisible characters before you suspect the node. (Fun sanity check: an empty input hashes to d41d8cd98f00b204e9800998ecf8427e, the well-known MD5 of nothing - a good way to confirm the node is wired up.)
One honest caveat, same as every node in this pack: MD5 is fine for fingerprints and dedup, not for security. Collision attacks against it are decades old. If you're building anything where an attacker could influence the text, use SHA-256 - this pack doesn't offer it.
Installing it
Search ComfyUI_md5 in ComfyUI Manager → install → restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/duldduld/ComfyUI_md5
# restart ComfyUI
No dependencies, no model files, nothing to pip install - about the safest custom node install there is. You'll find it under utils/hash → String to MD5, or just search "string to md5".
Bottom line
It's a hasher for text, and it does exactly one thing with zero fuss. If you've ever wanted a stable ID for "what did I actually run," this is the cheapest way to get one.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input_string | STRING | — | |
| case | COMBO | lower | 2 options: lower, upper |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| md5_hash | STRING | — |