View source code
Display the source code in std/digest/md.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
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.
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.
This module conforms to the APIs defined in std
. To understand the
differences between the template and the OOP API, see std
.
This module publicly imports std
and can be used as a stand-alone
module.
CTFE
Digests do not work in CTFE
References
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");
writeln(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(data)
|
This is a convenience alias for std using the
MD5 implementation.
|
Structs
Name | Description |
---|---|
MD5
|
Template API MD5 implementation.
See std for differences between template and OOP API.
|
Aliases
Name | Type | Description |
---|---|---|
MD5Digest
|
std
|
OOP API MD5 implementation.
See std 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
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.