mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Remove SHA3-256 hash as it turned out it is slower as SHA256
In some tests it seemed that SHA3-256 is 30% fast than SHA256 but later with the data we used in dao testnet it was actually slower. To avoid confusion which hash function to use and to avoid mixing them without strong reason I prefer to remove it again.
This commit is contained in:
parent
7651a946e4
commit
6d5b404876
@ -82,29 +82,5 @@ public class Hash {
|
||||
digest.doFinal(out, 0);
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data Data as byte array
|
||||
* @return Hash of data
|
||||
*/
|
||||
public static byte[] getSha3_256Hash(byte[] data) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA3-256");
|
||||
digest.update(data, 0, data.length);
|
||||
return digest.digest();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
log.error("Could not create MessageDigest for hash. " + e.toString());
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates RIPEMD160(SHA3-256(data)).
|
||||
*/
|
||||
public static byte[] getSha3_256Ripemd160hash(byte[] data) {
|
||||
byte[] sha3_256Hash = getSha3_256Hash(data);
|
||||
return getRipemd160hash(sha3_256Hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user