[io] sha512
This commit is contained in:
parent
50442e31e3
commit
a68578f73f
|
@ -27,6 +27,17 @@ public class HashUtils {
|
|||
return formatter.toString();
|
||||
}
|
||||
|
||||
public static String sha512(byte[] data) {
|
||||
Formatter formatter = new Formatter();
|
||||
try {
|
||||
for (byte b : MessageDigest.getInstance("SHA-512").digest(data))
|
||||
formatter.format("%02x", b);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("Could not hash using SHA512", e);
|
||||
}
|
||||
return formatter.toString();
|
||||
}
|
||||
|
||||
public static long murmur2(byte[] data) {
|
||||
final int m = 0x5bd1e995;
|
||||
final int r = 24;
|
||||
|
|
Loading…
Reference in New Issue