Nodes/ComfyUI_md5/File to MD5
ComfyUI Node

File to MD5

Hash any file on disk without leaving your workflow

By duldduld·Created 12 months ago·Updated 9 months ago· 2
File to MD5
    • md5_hash
    file_path
    caselower

    Why you'd reach for it

    Every checkpoint page on CivitAI and Hugging Face publishes a checksum for the file, and most people skip verifying it because it means opening a terminal. FileToMD5 lets you do the same check from inside the graph: point it at a file path, get a 32-character hex string, compare it against the hash the uploader posted. It's the difference between catching a corrupted .safetensors before you load it and discovering it after an hour of "why do my images look wrong."

    It's also handy for versioning your own stuff. Drop it on a workflow file, a LoRA you've been tweaking, or a checkpoint you downloaded twice from different mirrors - if the hash matches, the bytes match. That's the whole job, and it does it with no dependencies, no models, no GPU.

    How it works

    FileToMD5 reads the file in 4096-byte chunks and feeds them through Python's hashlib.md5. Chunked reading matters more than it sounds: it never loads the whole file into RAM, so hashing a 7 GB checkpoint or a video file doesn't spike your memory. It's pure standard library - no numpy, no torch on this node. MD5 is fast, so even big files take a few seconds at most.

    Inputs and outputs

    • file_path (STRING) - the full path to the file, extension included. There's no file picker; you type it.
    • case (enum, default lower) - lower or upper. Purely cosmetic. MD5 hashes are conventionally lowercase, but if your downstream comparison expects uppercase, flip it.
    • md5_hash (STRING, output) - the 32-character hex digest, ready to wire into a text display node or a comparison.

    That's the whole schema. Two inputs, one output.

    The gotcha that will bite you

    If the path is wrong, the node returns the literal string "error" instead of raising an exception - the real message only goes to the console. So a typo'd path doesn't break your workflow; it silently hands you a "hash" that looks like a 5-character answer to a 32-character question. If your result looks suspiciously short, your path is wrong.

    Two related things: use an absolute path, because a relative one resolves against whatever directory ComfyUI is running from, not your home folder. And this hashes the file on disk, not anything in your graph - there's a sibling node, ImgToMD5, for that.

    Installing it

    The pack is called ComfyUI_md5. Easiest path: ComfyUI Manager → "Install Custom Nodes" → search ComfyUI_md5 → install → restart ComfyUI. Or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/duldduld/ComfyUI_md5
    # restart ComfyUI
    

    No requirements.txt, no pip install, no model downloads - this is one of the few installs that cannot break your environment. After restart, find it under Right-click → Add Node → utils/hash → File to MD5, or just search "file to md5".

    One honest caveat

    MD5 is a checksum, not a security tool. Collision attacks against it have been public since 2004, so it's fine for catching accidental corruption and doing dedup, but don't use it to authenticate something you don't trust. If you're verifying against a hash a hostile party could have chosen, use SHA-256 instead - this pack only does MD5, so that's a different node entirely. For the everyday "did my download survive" case, it's exactly what you want.

    Categoryutils/hash

    Inputs (2)

    NameTypeDefaultDescription
    file_pathSTRING
    caseCOMBOlower2 options: lower, upper

    Outputs (1)

    NameTypeDescription
    md5_hashSTRING