示例#1
0
 /** Calculates RIPEMD160(SHA256(input)). This is used in Address calculations. */
 public static byte[] sha256hash160(byte[] input) {
   byte[] sha256 = Sha256Hash.hash(input);
   RIPEMD160Digest digest = new RIPEMD160Digest();
   digest.update(sha256, 0, sha256.length);
   byte[] out = new byte[20];
   digest.doFinal(out, 0);
   return out;
 }
示例#2
0
 /** Calculates RIPEMD160(SHA256(input)). This is used in Address calculations. */
 public static byte[] sha256hash160(byte[] input) {
   try {
     byte[] sha256 = MessageDigest.getInstance("SHA-256").digest(input);
     RIPEMD160Digest digest = new RIPEMD160Digest();
     digest.update(sha256, 0, sha256.length);
     byte[] out = new byte[20];
     digest.doFinal(out, 0);
     return out;
   } catch (NoSuchAlgorithmException e) {
     throw new RuntimeException(e); // Cannot happen.
   }
 }