ComfyUI-Image-Encryption
Two ComfyUI custom nodes providing image encryption and decryption with password-derived SHA-256 keying, block permutation, and pixel diffusion.
ComfyUI-Image-Encryption
Two ComfyUI custom nodes are provided:
ImageEncrypt/Image EncryptionImageEncrypt/Image Decryption
The encryption pipeline follows the design in .personal-worklog/node design.md:
- password-derived SHA-256 keying
- block permutation with
Hilbert,Morton, orRandom - inner-block permutation
- pixel diffusion with
XOR,Chaotic XOR, orAES-CTR - chained diffusion for reversibility
The encryption node outputs:
- encrypted
IMAGE - encryption
metadataasJSON security_reportasJSON
The security report contains:
entropyhorizontal_corrvertical_corrdiagonal_corrnpcruaci
For batched inputs, the metadata and security_report JSON outputs become per-image lists.
Metric conventions:
entropyis computed over all encrypted RGB byte values as one scalar.- correlation metrics are computed on the encrypted grayscale image.
npcranduaciare computed between the padded plaintext image and the encrypted image so the compared arrays have identical shape.
In the same workflow, the encryption node also attaches metadata to the image tensor and to extra_pnginfo, so a downstream standard SaveImage node will persist the parameters into the PNG metadata.
When decrypting an image that was reloaded from disk, connect the saved metadata JSON explicitly if your loader path does not preserve the tensor-attached metadata in memory.