Cryptographic Hash Functions (Hàm băm mật mã)
| Thuật toán | Đầu ra | Thiết kế | Đặc điểm nổi bật | Trạng thái 2024 |
| SHA-256 | 256-bit | Merkle-Damgård | Tiêu chuẩn NIST, TLS, Bitcoin, JWT, Git, hardware accel | Mặc định #1 |
| SHA-512 | 512-bit | Merkle-Damgård | Nhanh trên 64-bit, SHA-512/256 chống length extension | Thay thế SHA-256 trên 64-bit |
| SHA3-256 | 256-bit | Sponge (Keccak) | Không length extension, đa dạng hóa, side-channel resistant | Dự phòng, PQC-friendly |
| SHAKE256 | Tuỳ ý (XOF) | Sponge | Extendable output, domain separation tự nhiên | Khuyên dùng cho KDF, protocol design |
| BLAKE2b | 512-bit (tùy chỉnh) | HAIFA (Merkle-Damgård improved) | Nhanh hơn SHA-1/MD5, keyed mode (MAC), salt, personalization | Hiệu năng cao, thay thế SHA-256 |
| BLAKE3 | 256-bit (XOF) | Tree-hash + BLAKE2 | Song song, SIMD, cực nhanh (~1 cpb), keyed, derive key | Xuân tinh 2024+ cho performance |
Password Hashing / Key Derivation Functions (KDF)
| Thuật toán | Loại | Đặc điểm | Khuyên dùng |
| Argon2id | Memory-hard KDF | PHC winner, time+memory+parallelism tunable, side-channel resistant | #1 Mặc định |
| bcrypt | Blowfish-based KDF | Work factor (log₂ rounds), 72-byte limit, widely supported | #2 Tương thích rộng |
| scrypt | Memory-hard KDF | N, r, p params, Litecoin, memory-hard gốc | Tốt, ít support hơn Argon2 |
| PBKDF2-HMAC-SHA256 | Time-hard KDF | Chỉ iteration count, FIPS approved, no memory hardness | Chỉ khi bắt buộc FIPS/legacy |
Non-Cryptographic / Checksum (Không dùng cho bảo mật)
| Thuật toán | Đầu ra | Dùng cho |
| xxHash (XXH3/XXH64) | 64/128-bit | Hash table, deduplication, database index, checksum nhanh |
| MurmurHash3 | 32/128-bit | Hash table, Bloom filter, Cassandra, HBase |
| FNV-1a | 32/64-bit | Hash table đơn giản, embedded |
| CRC32C (Castagnoli) | 32-bit | Network/storage error detection, hardware accel (Intel SSE4.2, ARM CRC) |
| SipHash | 64/128-bit | Hash table chống DoS (HashDoS), keyed, fast |
Legacy / Broken (Cấm dùng cho bảo mật mới)
- MD5 (128-bit): Collision practical (2004), chosen-prefix (2008). Chỉ dùng checksum non-security.
- SHA-1 (160-bit): Collision SHAttered (2017). HMAC-SHA1 chấp nhận được nhưng deprecated.
- RIPEMD-160: Chỉ dùng Bitcoin legacy (Hash160).
- LANMAN / NTLMv1: Windows legacy, cực yếu, dễ brute-force.
Khuyến nghị nhanh
# General purpose crypto hash
sha256(data) # Default, everywhere
blake3(data) # High performance, parallel, XOF
shake256(data, 32) # Need XOF / domain separation
# Password storage
argon2id(password, salt, t=3, m=64MB, p=4) # Default
bcrypt(password, cost=12) # Compatibility
# Non-crypto checksum / hash table
xxh3(data) # Fastest general
crc32c(data) # Hardware accelerated error detection
siphash(key, data) # HashDoS resistant hash table