implement tests
Some checks failed
/ publish (push) Has been cancelled

also fix MD5
This commit is contained in:
2025-11-10 17:42:15 +01:00
parent 9b93fbd093
commit d033d895da
28 changed files with 469 additions and 30 deletions

View File

@@ -0,0 +1,34 @@
package com.infendro.hash.keccak.sha3
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `SHA3-256 Test` {
val function = `SHA3-256`
@Test
fun `bytes and block`() {
assertEquals(32, function.bytes)
assertEquals(256, function.bits)
assertEquals(136, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xa7U, 0xffU, 0xc6U, 0xf8U,
0xbfU, 0x1eU, 0xd7U, 0x66U,
0x51U, 0xc1U, 0x47U, 0x56U,
0xa0U, 0x61U, 0xd6U, 0x62U,
0xf5U, 0x80U, 0xffU, 0x4dU,
0xe4U, 0x3bU, 0x49U, 0xfaU,
0x82U, 0xd8U, 0x0aU, 0x4bU,
0x80U, 0xf8U, 0x43U, 0x4aU,
)
val actual = function.hash(
ubyteArrayOf()
)
assertContentEquals(expected, actual)
}
}