Construct a Ripemd128
Length padding size
block size
Obtain the digest
The size of a Ripemd128 digest is 16 bytes
Performs the length padding
Pads the cipher data
Initialize the cipher
Performs the cipher on a block of data
Constructs the digest
Digest block size
Length padding size
Pads the digest data
Performs the length padding
Performs the digest on a block of data
Final processing of digest.
Initialize the digest
Digest additional data
Complete the digest
Converts 8 bit to 32 bit Little Endian
Converts 8 bit to 32 bit Big Endian
Converts 8 bit to 64 bit Little Endian
Converts 8 bit to 64 bit Big Endian
Rotate left by n
static istring[] strings = [ "", "a", "abc", "message digest", "abcdefghijklmnopqrstuvwxyz", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "12345678901234567890123456789012345678901234567890123456789012345678901234567890" ]; static istring[] results = [ "cdf26213a150dc3ecb610f18f6b38b46", "86be7afa339d0fc7cfc785e72f578d33", "c14a12199c66e4ba84636b0f69144c77", "9e327b3d6e523062afc1132d7df9d1b8", "fd2aa607f71dc8f510714922b371834e", "a1aa0689d0fafa2ddc22e88b49133a06", "d1e959eb179c911faea4624c60c5c702", "3f45ef194732c2dbb2c4a2c769795fa3" ]; Ripemd128 h = new Ripemd128(); foreach (i, s; strings) { h.update(cast(ubyte[]) s); char[] d = h.hexDigest; test(d == results[i],":("~s~")("~d~")!=("~results[i]~")"); } char[] s = new char[1000000]; for (auto i = 0; i < s.length; i++) s[i] = 'a'; auto result = "4a7f5723f954eba1216c9d8f6320431f"; h.update(cast(ubyte[]) s); auto d = h.hexDigest; test(d == result,":(1 million times \"a\")("~d~")!=("~result~")");