org.bitcoin.x6763.crypto.digest
Class RIPEMD160

java.lang.Object
  extended by org.bitcoin.x6763.crypto.digest.RIPEMD160

public class RIPEMD160
extends java.lang.Object

The RIPEMD160 provides methods for hashing data with the RIPEMD-160 digest.

There are two ways this class can be used. The first way is to use the static hash method, which will internally instantiate the RIPEMD160 class on each call:

 byte[] data = new String("abc").getBytes();
 byte[] hash = RIPEMD160.hash(data);
 
 
The second way is to instantiate a RIPEMD160 object and use the hashBytes instance method. Each call to hashBytes resets the RIPEMD160 digest, so each hash does not affect the next.
 RIPEMD160 ripemd160 = new RIPEMD160();
 
 byte[] data1 = new String("abc").getBytes();
 byte[] hash1 = ripemd160.hashBytes(data1);
 
 byte[] data2 = new String("def").getBytes();
 byte[] hash2 = ripemd160.hashBytes(data2);
 
 
The update and digest instance methods can also be used directly, as well.

Author:
Bouncy Castle contributors - http://www.bouncycastle.org/contributors.html, x6763

Constructor Summary
RIPEMD160()
          Creates a RIPEMD160 digest instance.
 
Method Summary
 byte[] digest()
          Completes the RIPEMD160 hash computation by performing the final operations such as padding.
 byte[] digest(byte data)
          Completes the RIPEMD160 hash computation by performing the final operations such as padding.
 byte[] digest(byte[] data)
          Completes the RIPEMD160 hash computation by performing the final operations such as padding.
 byte[] digest(byte[] data, int offset, int length)
          Completes the RIPEMD160 hash computation by performing the final operations such as padding.
 int doFinal(byte[] out, int outOff)
           
 void finish()
           
 int getByteLength()
           
 int getDigestSize()
           
static byte[] hash(byte[] data)
          Hashes an array of bytes with the RIPEMD160 algorithm.
 byte[] hashBytes(byte[] data)
          Hashes an array of bytes with the RIPEMD160 algorithm.
 void reset()
          reset the chaining variables to the IV values.
 void update(byte data)
          Updates the RIPEMD160 digest using the specified byte.
 void update(byte[] data)
          Updates the RIPEMD160 digest using the specified array of bytes
 void update(byte[] data, int offset, int length)
          Updates the RIPEMD160 digest using the specified array of bytes, starting at the specified offset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RIPEMD160

public RIPEMD160()
Creates a RIPEMD160 digest instance.

Method Detail

hash

public static byte[] hash(byte[] data)
Hashes an array of bytes with the RIPEMD160 algorithm.

Parameters:
data - the array of bytes to hash
Returns:
the array of bytes for the resulting hash value

hashBytes

public byte[] hashBytes(byte[] data)
Hashes an array of bytes with the RIPEMD160 algorithm.

Parameters:
data - the array of bytes to hash
Returns:
the array of bytes for the resulting hash value

update

public void update(byte data)
Updates the RIPEMD160 digest using the specified byte.

Parameters:
data - the byte with which to update the digest

update

public void update(byte[] data)
Updates the RIPEMD160 digest using the specified array of bytes

Parameters:
data - the array of bytes to hash

update

public void update(byte[] data,
                   int offset,
                   int length)
Updates the RIPEMD160 digest using the specified array of bytes, starting at the specified offset.

Parameters:
data - the array of bytes to hash
offset - the offset to start from in the array of bytes
length - the number of bytes to use, starting at offset

digest

public byte[] digest()
Completes the RIPEMD160 hash computation by performing the final operations such as padding. The digest is reset after this call is made.

Returns:
the array of bytes for the resulting hash value

digest

public byte[] digest(byte data)
Completes the RIPEMD160 hash computation by performing the final operations such as padding. The digest is reset after this call is made.

Parameters:
data - the byte to be updated before the digest is completed
Returns:
the array of bytes for the resulting hash value

digest

public byte[] digest(byte[] data)
Completes the RIPEMD160 hash computation by performing the final operations such as padding. The digest is reset after this call is made.

Parameters:
data - the array of bytes to be updated before the digest is completed
Returns:
the array of bytes for the resulting hash value

digest

public byte[] digest(byte[] data,
                     int offset,
                     int length)
Completes the RIPEMD160 hash computation by performing the final operations such as padding. The digest is reset after this call is made.

Parameters:
data - the array of bytes to be updated before the digest is completed
offset - the offset to start from in the array of bytes
length - the number of bytes to use, starting at offset
Returns:
the array of bytes for the resulting hash value

getDigestSize

public int getDigestSize()

doFinal

public int doFinal(byte[] out,
                   int outOff)

finish

public void finish()

reset

public void reset()
reset the chaining variables to the IV values.


getByteLength

public int getByteLength()