tango.util.digest.Ripemd256

License:

BSD style: see doc/license.txt for details

Version:

Initial release: Sep 2009

Author:

Kai Nacke

This module implements the Ripemd256 algorithm by Hans Dobbertin, Antoon Bosselaers and Bart Preneel.

See http://homes.esat.kuleuven.be/~bosselae/ripemd160.html for more information. The implementation is based on: RIPEMD-160 software written by Antoon Bosselaers, available at http://www.esat.kuleuven.ac.be/~cosicart/ps/AB-9601/
class Ripemd256 : MerkleDamgard [final]
this()
Construct a Ripemd256
uint digestSize() [override]
The size of a Ripemd256 digest is 32 bytes
void reset() [override]
Initialize the cipher

Remarks:

Returns the cipher state to it's initial value
void createDigest(ubyte[] buf) [override]
Obtain the digest

Returns:

the digest

Remarks:

Returns a digest of the current cipher state, this may be the final digest, or a digest of the state between calls to update()
uint blockSize() [protected, override]
block size

Returns:

the block size

Remarks:

Specifies the size (in bytes) of the block of data to pass to each call to transform(). For Ripemd256 the blockSize is 64.
uint addSize() [protected, override]
Length padding size

Returns:

the length padding size

Remarks:

Specifies the size (in bytes) of the padding which uses the length of the data which has been ciphered, this padding is carried out by the padLength method. For Ripemd256 the addSize is 8.
void padMessage(ubyte[] at) [protected, override]
Pads the cipher data

Parameters:

dataa slice of the cipher buffer to fill with padding

Remarks:

Fills the passed buffer slice with the appropriate padding for the final call to transform(). This padding will fill the cipher buffer up to blockSize()-addSize().
void padLength(ubyte[] at, ulong length) [protected, override]
Performs the length padding

Parameters:

datathe slice of the cipher buffer to fill with padding
lengththe length of the data which has been ciphered

Remarks:

Fills the passed buffer slice with addSize() bytes of padding based on the length in bytes of the input data which has been ciphered.
void transform(const(ubyte[]) input) [protected, override]
Performs the cipher on a block of data

Parameters:

datathe block of data to cipher

Remarks:

The actual cipher algorithm is carried out by this method on the passed block of data. This method is called for every blockSize() bytes of input data and once more with the remaining data padded to blockSize().