tango.util.digest.Md5

License:
BSD style: see doc/license.txt for details

Version:
Initial release: Feb 2006

author:
Regan Heath, Oskar Linde

This module implements the MD5 Message Digest Algorithm as described by RFC 1321 The MD5 Message-Digest Algorithm. R. Rivest. April 1992.

class Md5: tango.util.digest.Md4.Md4;
Examples:
__gshared immutable immutable(char)[][] strings =
[
        "",
        "a",
        "abc",
        "message digest",
        "abcdefghijklmnopqrstuvwxyz",
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
        "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
];

__gshared immutable immutable(char)[][] results =
[
        "d41d8cd98f00b204e9800998ecf8427e",
        "0cc175b9c0f1b6a831c399e269772661",
        "900150983cd24fb0d6963f7d28e17f72",
        "f96b697d7cb7938d525a2f31aaf161d0",
        "c3fcd3d76192e4007dfb496cca67e13b",
        "d174ab98d277d9f5a5611c2c9f419d9f",
        "57edf4a22be3c955ac49da2e2107b67a"
];

Md5 h = new Md5();

foreach (int i, immutable(char)[] s; strings)
        {
        h.update(cast(ubyte[]) s);
        char[] d = h.hexDigest();

        assert(d == results[i],":(")~s~"(")~d~"!=(")~results[i]~"");
        }


this();
Construct an Md5

protected void transform(const(ubyte[]) input);
Performs the cipher on a block of data

Params:
data the block of data to cipher

Remarks:
The actual cipher algorithm is carried out by this method on the passed block of data. This method is called for every blockSize() bytes of input data and once more with the remaining data padded to blockSize().


Page generated by Ddoc. Copyright (c) 2006 Tango. All rights reserved