Scheduled for deprecation. Please use std.digest.md instead.
Computes MD5 digests of arbitrary data. MD5 digests are 16 byte quantities that are like a checksum or crc, but are more robust.
There are two ways to do this. The first does it all in one function call to
sum(). The second is for when the data is buffered.
// This code is derived from the // RSA Data Security, Inc. MD5 Message-Digest Algorithm. import std.md5; import std.stdio; void main(string[] args) { foreach (arg; args) mdFile(arg); } /// Digests a file and prints the result. void mdFile(string filename) { ubyte[16] digest; MD5_CTX context; context.start(); foreach (buffer; File(filename).byChunk(64 * 1024)) context.update(buffer); context.finish(digest); writefln("MD5 (%s) = %s", filename, digestToString(digest)); }
Computes MD5 digest of several arrays of data.
Converts MD5 digest to a string.
Gets the digest of all data items passed in.
string a = "Mary has ", b = "a little lamb"; int[] c = [ 1, 2, 3, 4, 5 ]; string d = getDigestString(a, b, c);
Holds context of MD5 computation.
Used when data to be digested is buffered.
MD5 initialization. Begins an MD5 operation, writing a new context.
MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context.
MD5 finalization. Ends an MD5 message-digest operation, writing the the message to digest and zeroing the context.