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,33 @@
package com.infendro.hash.sha2
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `SHA-224 Test` {
val function = `SHA-224`
@Test
fun `bytes and block`() {
assertEquals(28, function.bytes)
assertEquals(224, function.bits)
assertEquals(64, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xd1U, 0x4aU, 0x02U, 0x8cU,
0x2aU, 0x3aU, 0x2bU, 0xc9U,
0x47U, 0x61U, 0x02U, 0xbbU,
0x28U, 0x82U, 0x34U, 0xc4U,
0x15U, 0xa2U, 0xb0U, 0x1fU,
0x82U, 0x8eU, 0xa6U, 0x2aU,
0xc5U, 0xb3U, 0xe4U, 0x2fU,
)
val actual = function.hash(
ubyteArrayOf()
)
assertContentEquals(expected, actual)
}
}