### Question:
Hash { public byte[] sha256(byte[] message) { buffer = new byte[SodiumConstants.SHA256BYTES]; sodium().crypto_hash_sha256(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 testSha256() throws Exception { final byte[] rawMessage = TestVectors.SHA256_MESSAGE.getBytes(); String result = HEX.encode(hash.sha256(rawMessage)); assertTrue("Hash is invalid", Arrays.equals(TestVectors.SHA256_DIGEST.getBytes(), result.getBytes())); }
@Test public void testSha256EmptyString() throws Exception { byte[] result = hash.sha256("".getBytes()); assertEquals("Hash is invalid", TestVectors.SHA256_DIGEST_EMPTY_STRING, HEX.encode(result)); }
@Test public void testSha256HexString() throws Exception { String result = hash.sha256(TestVectors.SHA256_MESSAGE, HEX); Assert.assertEquals("Hash is invalid", TestVectors.SHA256_DIGEST, result); }
@Test public void testSha256EmptyHexString() throws Exception { String result = hash.sha256("", HEX); Assert.assertEquals("Hash is invalid", TestVectors.SHA256_DIGEST_EMPTY_STRING, result); }
@Test public void testSha256NullByte() { try { hash.sha256("\0".getBytes()); } catch (Exception e) { fail("Should not raise any exception on null byte"); } }