### Question:
SHA256Hash { public static SHA256Hash.Hash hash(SHA256Hash.Input input) { Pointer output = Sodium.malloc(SHA256Hash.Hash.length()); Sodium.crypto_hash_sha256(output, input.value.pointer(), input.length()); return new SHA256Hash.Hash(output, SHA256Hash.Hash.length()); }  static SHA256Hash.Hash hash(SHA256Hash.Input input);  }### Answer:
@Test void hashValue() { SHA256Hash.Hash output = SHA256Hash.hash(SHA256Hash.Input.fromBytes(Bytes.random(384))); assertNotNull(output); assertEquals(32, output.bytes().size()); }
@Test void hashValue() { SHA256Hash.Hash output = SHA256Hash.hash(SHA256Hash.Input.fromBytes(Bytes.random(384))); assertNotNull(output); assertEquals(32, output.bytes().size()); assertFalse(output.isDestroyed()); output.destroy(); assertTrue(output.isDestroyed()); }
@Test void outputEquals() { SHA256Hash.Input input = SHA256Hash.Input.fromBytes(Bytes.random(384)); SHA256Hash.Hash output = SHA256Hash.hash(input); assertEquals(output, output); assertEquals(output.hashCode(), output.hashCode()); assertEquals(output, SHA256Hash.hash(input)); assertEquals(output.hashCode(), SHA256Hash.hash(input).hashCode()); }
@Test void testCompat() { Bytes toHash = Bytes.random(384); SHA256Hash.Input input = SHA256Hash.Input.fromBytes(toHash); SHA256Hash.Hash output = SHA256Hash.hash(input); assertEquals(Hash.sha2_256(toHash), output.bytes()); }