### Question:
Hash { public byte[] sha512(byte[] message) { buffer = new byte[SodiumConstants.SHA512BYTES]; sodium().crypto_hash_sha512(buffer, message, message.length); return buffer; }  byte[] sha256(byte[] message); byte[] sha512(byte[] message); String sha256(String message, Encoder encoder); String sha512(String message, Encoder encoder); String pwhash_scryptsalsa208sha256(String passwd, Encoder encoder, byte[] salt, int opslimit, int memlimit); byte[] blake2(byte[] message); String blake2(String message, Encoder encoder);  }### Answer:
@Test public void testSha512() throws Exception { final byte[] rawMessage = TestVectors.SHA512_MESSAGE.getBytes(); String result = HEX.encode(hash.sha512(rawMessage)); assertTrue("Hash is invalid", Arrays.equals(TestVectors.SHA512_DIGEST.getBytes(), result.getBytes())); }
@Test public void testSha512EmptyString() throws Exception { byte[] result = hash.sha512("".getBytes()); assertEquals("Hash is invalid", TestVectors.SHA512_DIGEST_EMPTY_STRING, HEX.encode(result)); }
@Test public void testSha512HexString() throws Exception { String result = hash.sha512(TestVectors.SHA512_MESSAGE, HEX); Assert.assertEquals("Hash is invalid", TestVectors.SHA512_DIGEST, result); }
@Test public void testSha512EmptyHexString() throws Exception { String result = hash.sha512("", HEX); Assert.assertEquals("Hash is invalid", TestVectors.SHA512_DIGEST_EMPTY_STRING, result); }
@Test public void testSha512NullByte() { try { hash.sha512("\0".getBytes()); } catch (Exception e) { fail("Should not raise any exception on null byte"); } }