Use SHA-256 for security, compare in constant time, and pin by digest when identity matters.
Digests that hold
Never compare with `==` in security code
Use constant-time comparison (
hash_equalsin PHP,hmac.compare_digestin Python) to avoid timing side-channels.Pin by digest, not tag
Container images, tarballs and packages should reference
name@sha256:..., notname:latest.Prefer SHA-256
MD5 and SHA-1 have known collision attacks. Never use them for security, signatures or integrity.
Record the digest in the manifest
Every artifact should carry its digest in the manifest so deploys can verify.