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,42 @@
package com.infendro.hash.keccak.sha3
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `SHA3-512 Test` {
val function = `SHA3-512`
@Test
fun `bytes and block`() {
assertEquals(64, function.bytes)
assertEquals(512, function.bits)
assertEquals(72, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xa6U, 0x9fU, 0x73U, 0xccU,
0xa2U, 0x3aU, 0x9aU, 0xc5U,
0xc8U, 0xb5U, 0x67U, 0xdcU,
0x18U, 0x5aU, 0x75U, 0x6eU,
0x97U, 0xc9U, 0x82U, 0x16U,
0x4fU, 0xe2U, 0x58U, 0x59U,
0xe0U, 0xd1U, 0xdcU, 0xc1U,
0x47U, 0x5cU, 0x80U, 0xa6U,
0x15U, 0xb2U, 0x12U, 0x3aU,
0xf1U, 0xf5U, 0xf9U, 0x4cU,
0x11U, 0xe3U, 0xe9U, 0x40U,
0x2cU, 0x3aU, 0xc5U, 0x58U,
0xf5U, 0x00U, 0x19U, 0x9dU,
0x95U, 0xb6U, 0xd3U, 0xe3U,
0x01U, 0x75U, 0x85U, 0x86U,
0x28U, 0x1dU, 0xcdU, 0x26U,
)
val actual = function.hash(
ubyteArrayOf()
)
assertContentEquals(expected, actual)
}
}