해시(Hash) 알고리즘 종류 및 길이

해시(Hash) 알고리즘 종류 및 길이

in

해시는 임의의 길이를 갖는 임의의 데이터를 고정된 길이의 데이터로 매핑하는 단방향 함수를 말합니다.

그러나 오래된 해시함수의 경우 알고리즘의 취약점이 발견되면서 역으로 평문값을 알아낼 수 있는 경우도 존재합니다. 특히 각종 워게임에서 크랙이 가능한 취약한 해시 함수들을 많이 응용하고 있으며 실제로 취약한 해시를 사용하고 있는 서비스도 존재합니다.

해당 해시가 취약한 알고리즘으로 구성되어 있는지 검증하기 위해서는 해시값의 형태나 길이로 종류를 판단하고 크랙을 시도해야 합니다.

이때 참고할 수 있는 해시 알고리즘의 종류와 길이를 정리해 보았습니다.

순환 중복 검사(Cyclic Redundancy Checks)

Name Length(str) Length(bit) Type
checksum (Unix) 8 32 bits CRC with length appended
CRC-16 4 16 bits CRC
CRC-32 8 32 bits CRC
CRC-32 MPEG-2 8 32 bits CRC
CRC-32C 8 32 bits CRC
CRC-64 16 64 bits CRC


Checksums

Name Length(str) Length(bit) Type
BSD checksum (Unix) 4 16 bits sum with circular rotation
SYSV checksum (Unix) 4 16 bits sum with circular rotation
sum8 2 8 bits sum
Internet Checksum 4 16 bits sum (ones’ complement)
sum24 6 24 bits sum
sum32 8 32 bits sum
fletcher-4 1 4 bits sum
fletcher-8 2 8 bits sum
fletcher-16 4 16 bits sum
fletcher-32 8 32 bits sum
Adler-32 8 32 bits sum
xor8 2 8 bits sum
Luhn algorithm 1 1 decimal digit sum
Verhoeff algorithm 1 1 decimal digit sum
Damm algorithm 1 1 decimal digit Quasigroup operation operation


범용 해시 함수(Universal hash function families)

Name Length Type
Rabin fingerprint variable multiply
tabulation hashing variable XOR
universal one-way hash function    
Zobrist hashing variable XOR


비암호화 해시 함수(Non-cryptographic hash functions)

Name Length(str) Length(bit) Type
Pearson hashing 2 8 bits (or more) XOR/table
Paul Hsieh’s SuperFastHash 8 32 bits  
Buzhash   variable XOR/table
Fowler-Noll-Vo hash function(FNV Hash) 8, 16, 32, 64, 128, or 256 32, 64, 128, 256,512, or 1024 bits xor/product orproduct/XOR
Jenkins hash function 8 or 16 32 or 64 bits XOR/addition
Bernstein’s hash djb2 8 or 16 32 or 64 bits shift/add or mult/addor shift/add/xor or mult/xor
PJW hash / Elf Hash 8 or 16 32 or 64 bits add,shift,xor
MurmurHash 8, 16, or 32 32, 64, or 128 bits product/rotation
Fast-Hash 8, 16 32, 64 bits xorshift
SpookyHash 8, 16, or 32 32, 64, or 128 bits see Jenkins hash function
CityHash 8, 16, 32, or 64 32, 64, 128, or 256 bits  
FarmHash 8, 16, or 32 32, 64 or 128 bits  
MetroHash 16 or 32 64 or 128 bits  
numeric hash (nhash)   variable division/modulo
xxHash 8, 16, 32 32, 64, 128 bits product/rotation
t1ha (Fast Positive Hash) 16 and 32 64 and 128 bits product/rotation/XOR/add
pHash   fixed or variable see Perceptual hashing
dhash 32 128 bits see Perceptual hasing
SDBM 8 or 16 32 or 64 bits mult/add or shift/addalso used in GNU AWK
OSDB hash 16 64 bits add


키 암호화 해시 함수(Keyed cryptographic hash functions)

Name Tag Length Type
BLAKE2 arbitrary keyed hash function (prefix-MAC)
BLAKE3 arbitrary keyed hash function (supplied IV)
HMAC    
KMAC arbitrary based on Keccak
MD6 512 bits Merkle tree NLFSR
One-key MAC (OMAC; CMAC)    
PMAC (cryptography)    
Poly1305-AES 128 bits nonce-based
SipHash 32, 64 or 128 bits non-collision-resistant PRF
HighwayHash 64, 128 or 256 bits non-collision-resistant PRF
UMAC    
VMAC    


키가 없는 암호화 해시 함수(Unkeyed cryptographic hash functions)

Name Length(str) Length(bit) Type
BLAKE-256 64 256 bits HAIFA structure
BLAKE-512 128 512 bits HAIFA structure
BLAKE2s up to 64 up to 256 bits HAIFA structure
BLAKE2b up to 128 up to 512 bits HAIFA structure
BLAKE2X arbitrary arbitrary HAIFA structure, extensible-output functions (XOFs) design
BLAKE3 arbitrary arbitrary Merkle tree
ECOH 56 to 128 224 to 512 bits hash
FSB 40 to 128 160 to 512 bits hash
GOST 64 256 bits hash
Grøstl up to 128 up to 512 bits hash
HAS-160 40 160 bits hash
HAVAL 32 to 64 128 to 256 bits hash
JH 56 to 128 224 to 512 bits hash
LSH 64 to 128 256 to 512 bits wide-pipe Merkle–Damgård construction
MD2 32 128 bits hash
MD4 32 128 bits hash
MD5 32 128 bits Merkle–Damgård construction
MD6 up to 128 up to 512 bits Merkle tree NLFSR (it is also a keyed hash function)
RadioGatún arbitrary arbitrary ideal mangling function
RIPEMD 32 128 bits hash
RIPEMD-128 32 128 bits hash
RIPEMD-160 40 160 bits hash
RIPEMD-320 80 320 bits hash
SHA-1 40 160 bits Merkle–Damgård construction
SHA-224 56 224 bits Merkle–Damgård construction
SHA-256 64 256 bits Merkle–Damgård construction
SHA-384 96 384 bits Merkle–Damgård construction
SHA-512 128 512 bits Merkle–Damgård construction
SHA-3 (subset of Keccak) arbitrary arbitrary sponge function
Skein arbitrary arbitrary Unique Block Iteration
Snefru 32 or 64 128 or 256 bits hash
Spectral Hash 128 512 bits wide-pipe Merkle–Damgård construction
Streebog 64 or 128 256 or 512 bits Merkle–Damgård construction
SWIFFT 128 512 bits hash
Tiger 48 192 bits Merkle–Damgård construction
Whirlpool 128 512 bits hash


References