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.

Module std.digest.md

Computes MD5 hashes of arbitrary data. MD5 hashes are 16 byte quantities that are like a checksum or CRC, but are more robust.

Category Functions
Template API MD5
OOP API MD5Digest
Helpers md5Of

This module conforms to the APIs defined in std.digest.digest. To understand the differences between the template and the OOP API, see std.digest.digest.

This module publicly imports std.digest.digest and can be used as a stand-alone module.

CTFE

Digests do not work in CTFE

References

Wikipedia on MD5

Example

//Template API
import std.digest.md;

//Feeding data
ubyte[1024] data;
MD5 md5;
md5.start();
md5.put(data[]);
md5.start(); //Start again
md5.put(data[]);
auto hash = md5.finish();

Example

//OOP API
import std.digest.md;

auto md5 = new MD5Digest();
ubyte[] hash = md5.digest("abc");
assert(toHexString(hash) == "900150983CD24FB0D6963F7D28E17F72");

//Feeding data
ubyte[1024] data;
md5.put(data[]);
md5.reset(); //Start again
md5.put(data[]);
hash = md5.finish();

Functions

Name Description
md5Of This is a convenience alias for std.digest.digest.digest using the MD5 implementation.

Structs

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

Aliases

Name Type Description
MD5Digest WrapperDigest!(std.digest.md.MD5) OOP API MD5 implementation. See std.digest.digest for differences between template and OOP API.

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