ComfyUI Node

Text to MD5 JNK

A stable, tiny ID for any text

By AljnkΒ·Created about a year agoΒ·Updated 12 months agoΒ· 3
Text to MD5 JNK
    • md5_hash
    β—„textβ–Ί

    Every workflow eventually needs a unique identifier that isn't a counter - a fingerprint of a prompt, a dedupe key for a batch, a stable suffix for filenames. "Text to MD5 JNK" hashes any string into a 32-character hex MD5, and it's deterministic: same text in, same hash out, every time. That reproducibility is the whole value. The pack README sums it up: "Generate MD5 hashes from text for unique identifiers."

    The mechanism is one stdlib call - hashlib.md5(text.encode()).hexdigest() - but the practical consequences are what make it worth a node. Because the hash is a pure function of the input, you can use it as a cache key or a dedupe key: hash the prompt plus settings, and you get an ID that changes only when the input actually changes. Two runs of identical text produce identical hashes, which is exactly what you want for "did I already process this?" logic. The output is a fixed 32-char lowercase hex string, regardless of input length, so a paragraph of prompt text becomes something you can stick in a filename without escaping nightmares.

    A couple of honest caveats before you lean on it for anything serious. MD5 is not a cryptographic hash - it's fine for deduplication and casual identifiers, but don't use it as a security or integrity check in this context; it's collision-prone and broken for adversarial use. And note the hash is computed over the exact bytes of the text, so Prompt A and Prompt A (trailing space) hash differently. If you're hashing prompts, run them through a trim node first or you'll get "different" hashes for text that looks the same. The node logs a ---JNK---> [JNK MD5] line to the console showing the first 50 characters of input, which is handy for debugging which text produced which hash.

    The inputs are a single text field and the output is md5_hash. That's it - there's genuinely nothing else to configure, which makes it one of the simplest nodes in the pack.

    Install: ComfyUI Manager β†’ search "JNK" β†’ Install, then restart. Or:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
    

    Then restart. No dependencies - this is Python's built-in hashlib.

    Gotchas: the "same text, same hash" property cuts both ways - if you wanted a unique per-run ID (every execution different), this is the wrong node; that's the pack's Get Timestamp node's job, not a hash. And because it's deterministic, two different models or prompts that share text will collide - pair it with something variable (a timestamp, a counter) when you need guaranteed uniqueness. For stable, readable, filename-safe identifiers derived from content, it's the right tool, and it's free of dependencies and drama.

    CategoryπŸ”§ JNK

    Inputs (1)

    NameTypeDefaultDescription
    textSTRINGβ€”

    Outputs (1)

    NameTypeDescription
    md5_hashSTRINGβ€”