View source code Display the source code in std/digest/ripemd.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.ripemd

Computes RIPEMD-160 hashes of arbitrary data. RIPEMD-160 hashes are 20 byte quantities that are like a checksum or CRC, but are more robust.

Category Functions
Template API RIPEMD160
OOP API RIPEMD160Digest
Helpers ripemd160Of

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

Example

//Template API
import std.digest.md;

ubyte[20] hash = ripemd160Of("abc");
assert(toHexString(hash) == "8EB208F7E05D987A9B044A8E98C6B087F15A0BFC");

//Feeding data
ubyte[1024] data;
RIPEMD160 md;
md.start();
md.put(data[]);
md.start(); //Start again
md.put(data[]);
hash = md.finish();

Example

//OOP API
import std.digest.md;

auto md = new RIPEMD160Digest();
ubyte[] hash = md.digest("abc");
assert(toHexString(hash) == "8EB208F7E05D987A9B044A8E98C6B087F15A0BFC");

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

Functions

Name Description
ripemd160Of This is a convenience alias for std.digest.digest.digest using the RIPEMD160 implementation.

Structs

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

Aliases

Name Type Description
RIPEMD160Digest WrapperDigest!(std.digest.ripemd.RIPEMD160) OOP API RIPEMD160 implementation. See std.digest.digest for differences between template and OOP API.

Authors

Kai Nacke
The algorithm was designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel.
The D implementation is a direct translation of the ANSI C implementation by Antoon Bosselaers.

License

Boost License 1.0.

Comments