The OpenD Programming Language

MD5Digest

OOP API MD5 implementation. See std.digest for differences between template and OOP API.

This is an alias for $(REF WrapperDigest, std,digest)!MD5, see there for more information.

import std.digest.md;
alias MD5Digest = WrapperDigest!MD5

Examples

//Simple example, hashing a string using Digest.digest helper function
auto md5 = new MD5Digest();
ubyte[] hash = md5.digest("abc");
//Let's get a hash string
assert(toHexString(hash) == "900150983CD24FB0D6963F7D28E17F72");
 //Let's use the OOP features:
void test(Digest dig)
{
  dig.put(cast(ubyte) 0);
}
auto md5 = new MD5Digest();
test(md5);

//Let's use a custom buffer:
ubyte[16] buf;
ubyte[] result = md5.finish(buf[]);
assert(toHexString(result) == "93B885ADFE0DA089CDF634904FD59F71");

Meta