Construct an Sha0
The digest size of Sha-0 and Sha-1 is 20 bytes
Initialize the cipher
Obtain the digest
block size
Length padding size
Pads the cipher data
Performs the length padding
__gshared immutable immutable(char)[][] strings = [ "", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890" ]; __gshared immutable immutable(char)[][] results = [ "f96cea198ad1dd5617ac084a3d92c6107708c0ef", "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", "c1b0f222d150ebb9aa36a40cafdc8bcbed830b14", "b40ce07a430cfd3c033039b9fe9afec95dc1bdcd", "79e966f7a3a990df33e40e3d7f8f18d2caebadfa", "4aa29d14d171522ece47bee8957e35a41f3e9cff", ]; Sha0 h = new Sha0(); foreach (int i, immutable(char)[] s; strings) { h.update(s); char[] d = h.hexDigest(); assert(d == results[i],":("~s~")("~d~")!=("~results[i]~")"); }