View source code Display the source code in std/digest/md.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Alias std.digest.md.MD5Digest

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

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

Declaration

alias MD5Digest = WrapperDigest!(std.digest.md.MD5);

Example

//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");

Example

//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");

Authors

Piotr Szturmaj, Kai Nacke, Johannes Pfau
The routines and algorithms are derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm.

License

Boost License 1.0.

Comments