ComfyUI Node

SM3 Hashing

The Chinese national standard hash, for that one puzzle

By AzelusLightvale·Created 12 months ago·Updated 5 days ago· 1
SM3 Hashing
  • key
  • hash_bytes

SM3 is China's national standard hash function - the state-mandated equivalent of SHA-256, used across Chinese government and banking systems and a fixture of Chinese cryptography competitions and CTFs. For most of us it's a curiosity; for anyone following a Chinese ARG or working a puzzle that deliberately uses the country's crypto standards, it's the exact algorithm the puzzle expects. This node exists so you don't have to leave ComfyUI to produce it.

It's a real, serious hash - 256-bit output, Merkle–Damgård structure, no known practical break - not a toy. It just happens to be the one algorithm here you'll use maybe once, for that specific puzzle that demands it.

How it works

Minimal interface, same as SHA1:

  • key1 (BYTESLIKE) - your input data. No algorithm dropdown: SM3 is a single fixed algorithm.

Output is hash_bytes, a 32-byte BYTESLIKE digest - the same length as SHA-256, which is deliberate, since SM3 was designed to fill the same role in China that SHA-256 fills in Western crypto. It's backed by the cryptography library, so this is the genuine standard implementation.

Where it fits

Feed it bytes, get 32 bytes back, convert with String2Hex if you need the 64-hex-char form. In a workflow it behaves exactly like the other hashing nodes, so if you've used SHA2 you already know this one - the only difference is the algorithm in the digest. It's also worth a nod of appreciation that the pack even bothers: most Western node packs don't ship SM3 at all.

Installing it

Part of ComfyUI ARG Toolkit - ComfyUI Manager (search "ComfyUI ARG Toolkit") or:

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

Restart ComfyUI. No model files; dependencies handled by Manager.

Common issues

  • Bytes errors - convert plain strings to bytes before hashing.
  • 32-byte output - if a puzzle quotes an SM3 checksum and it isn't 32 bytes / 64 hex chars, you're looking at the wrong algorithm.
  • Since SM3 support in consumer tools is patchier than SHA-2, it's worth cross-checking a surprising result against a dedicated tool (Python's gmssl or an SM3 online utility) before assuming the node is right - the pack's own testing only claims to cover common use cases.
CategoryARG Toolkit/Cryptography/Modern/Hashing

Inputs (1)

NameTypeDefaultDescription
keyBYTESLIKEFirst key (mandatory)

Outputs (1)

NameTypeDescription
hash_bytesBYTESLIKE