Web & Dev

File Hash Algorithms

File-integrity hash algorithms — speed, output size, and when to use each.

For file integrity

AlgorithmSizeSpeed (1 core)SecurityWhen to use
CRC-3232 bit~5 GB/s❌ Not adversarialTransport error detection
xxHash 6464 bit~20 GB/s❌ Non-cryptoFast dedup / cache keys
xxHash 128 (XXH3)128 bit~30 GB/s❌ Non-cryptoDeduplication
MD5128 bit~700 MB/s❌ BrokenLegacy checksums only
SHA-1160 bit~600 MB/s❌ BrokenGit objects (migrating away)
SHA-256256 bit~500 MB/s✓ SecureDefault integrity (package managers, signed releases)
SHA-512512 bit~700 MB/s✓ SecureFaster than SHA-256 on 64-bit
BLAKE2b512 bit~1 GB/s✓ SecureFast crypto integrity
BLAKE3arbitrary~3 GB/s✓ SecureParallel, streaming

Guidance

  • Adversarial (downloads, signatures): SHA-256 minimum; BLAKE3 for speed + security.
  • Non-adversarial dedup: xxHash or BLAKE3 — faster, same effective collision odds.
  • Never rely on MD5 or SHA-1 where an attacker could forge content.
  • Git uses SHA-1 today with collision detection; SHA-256 migration is in progress.
Was this article helpful?