|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bitcoin.x6763.crypto.digest.Hash160
public class Hash160
The Hash160
class provides methods for hashing data first
with SHA-256, and feeding that result into the RIPEMD-160
hash.
There are two ways this class can be used.
The first way is to use the static hash
method, which
will internally instantiate the SHA256
and RIPEMD160
classes on
each call:
byte[] data = new String("abc").getBytes();
byte[] hash = Hash160.hash(data);
The second way is to instantiate a Hash160
object and use the hashBytes
instance method. The Hash160
object will then reuse the same SHA256
and
RIPEMD160
objects for each call to hashBytes
:
Hash160 hash160 = new Hash160();
byte[] data1 = new String("def").getBytes();
byte[] hash1 = hash160.hashBytes(data1);
byte[] data2 = new String("ghi").getBytes();
byte[] hash2 = hash160.hashBytes(data2);
Constructor Summary | |
---|---|
Hash160()
Creates a Hash160 digest instance. |
Method Summary | |
---|---|
static byte[] |
hash(byte[] data)
Hashes an array of bytes with the SHA-256 algorithm, followed by the RIPEMD-160 algorithm. |
byte[] |
hashBytes(byte[] data)
Hashes an array of bytes with the SHA-256 algorithm, followed by the RIPEMD-160 algorithm. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Hash160()
Method Detail |
---|
public static byte[] hash(byte[] data)
data
- the array of bytes to hash
public byte[] hashBytes(byte[] data)
data
- the array of bytes to hash
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |