@Test public void success_1() { String data = "demo"; byte[] sha512 = Hashes.hash(HashAlgorithm.SHA_512, data.getBytes()); byte[] keccakHash512 = Hashes.hash(HashAlgorithm.KECCAK_512, data.getBytes()); byte[] keccakHash256 = Hashes.hash(HashAlgorithm.KECCAK_256, data.getBytes()); byte[] emptyByteArray = Hashes.hash(HashAlgorithm.KECCAK_512, new byte[32]); byte[] emptySha512 = Hashes.hash(HashAlgorithm.SHA_512, new byte[32]); assertThat(HexEncoder.getString(sha512), is("26c669cd0814ac40e5328752b21c4aa6450d16295e4eec30356a06a911c23983aaebe12d5da38eeebfc1b213be650498df8419194d5a26c7e0a50af156853c79")); assertThat(HexEncoder.getString(keccakHash512), is("fbf3b9980951aa921b8e30b782317a77a0dcc855551fd86720b1050bf8d40d30a07404021379a7bc8dbbcf8a4506c1c84db02e2e7a4441b80d154d1e7addb2fd")); assertThat(HexEncoder.getString(keccakHash256), is("3a784687a2b2ff9a2c72e22b001d33d9f2e2155a7858ff663b0990d35f14745d")); assertThat(HexEncoder.getString(emptyByteArray), is("0f6f7226432c21d4dfa2a1538a1fdc72ee1faf405a60e5f408b344a2f5aab2ddff0f9c172b6f7e2259b7929bce06388ecf84a51605bc48cd0b3c51d0eb12e3fa")); assertThat(HexEncoder.getString(emptySha512), is("5046adc1dba838867b2bbbfdd0c3423e58b57970b5267a90f57960924a87f1960a6a85eaa642dac835424b5d7c8d637c00408c7a73da672b7f498521420b6dd3")); }
public static byte[] hash(HashAlgorithm algorithm, byte[]... inputs) { return hash(algorithm, algorithm.getDefaultBitLength() / 8, inputs); }
Hashes { public static byte[] hash(HashAlgorithm algorithm, byte[]... inputs) { return hash(algorithm, algorithm.getDefaultBitLength() / 8, inputs); } }
Hashes { public static byte[] hash(HashAlgorithm algorithm, byte[]... inputs) { return hash(algorithm, algorithm.getDefaultBitLength() / 8, inputs); }  }
Hashes { public static byte[] hash(HashAlgorithm algorithm, byte[]... inputs) { return hash(algorithm, algorithm.getDefaultBitLength() / 8, inputs); }  static byte[] hash(HashAlgorithm algorithm, byte[]... inputs); static byte[] hash(HashAlgorithm algorithm, int outputByteLength, byte[]... inputs); }
Hashes { public static byte[] hash(HashAlgorithm algorithm, byte[]... inputs) { return hash(algorithm, algorithm.getDefaultBitLength() / 8, inputs); }  static byte[] hash(HashAlgorithm algorithm, byte[]... inputs); static byte[] hash(HashAlgorithm algorithm, int outputByteLength, byte[]... inputs);  }