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.

Struct std.digest.ripemd.RIPEMD160

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

Methods

Name Description
finish Returns the finished RIPEMD160 hash. This also calls start to reset the internal state.
put Use this to feed the digest with data. Also implements the std.range.primitives.isOutputRange interface for ubyte and const(ubyte)[].
start Used to (re)initialize the RIPEMD160 digest.

Example

//Simple example, hashing a string using ripemd160Of helper function
ubyte[20] hash = ripemd160Of("abc");
//Let's get a hash string
assert(toHexString(hash) == "8EB208F7E05D987A9B044A8E98C6B087F15A0BFC");

Example

//Using the basic API
RIPEMD160 hash;
hash.start();
ubyte[1024] data;
//Initialize data here...
hash.put(data);
ubyte[20] result = hash.finish();

Example

//Let's use the template features:
void doSomething(T)(ref T hash) if(isDigest!T)
{
    hash.put(cast(ubyte)0);
}
RIPEMD160 md;
md.start();
doSomething(md);
assert(toHexString(md.finish()) == "C81B94933420221A7AC004A90242D8B1D3E5070D");

Example

//Simple example
RIPEMD160 hash;
hash.start();
hash.put(cast(ubyte)0);
ubyte[20] result = hash.finish();
assert(toHexString(result) == "C81B94933420221A7AC004A90242D8B1D3E5070D");

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