Construct a Sha1 hash algorithm context
Performs the cipher on a block of data
The digest size of Sha-0 and Sha-1 is 20 bytes
Initialize the cipher
Obtain the digest
To be implemented
block size
Length padding size
Pads the cipher data
Performs the length padding
static istring[] strings = [ "abc", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "a", "0123456701234567012345670123456701234567012345670123456701234567" ]; static istring[] results = [ "a9993e364706816aba3e25717850c26c9cd0d89d", "84983e441c3bd26ebaae4aa1f95129e5e54670f1", "34aa973cd4c4daa4f61eeb2bdbad27316534016f", "dea356a2cddd90c7a7ecedc5ebb563934f460452" ]; static int[] repeat = [ 1, 1, 1000000, 10 ]; Sha1 h = new Sha1(); foreach (i, s; strings) { for(int r = 0; r < repeat[i]; r++) h.update(s); char[] d = h.hexDigest(); test(d == results[i],":("~s~")("~d~")!=("~results[i]~")"); }