Files
hash.kt/src/commonTest/kotlin/com/infendro/hash/keccak/sha3/SHA3-256.kt
2026-03-11 18:53:00 +01:00

29 lines
824 B
Kotlin

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 = byteArrayOf(
-0x59, -0x01, -0x3a, -0x08, -0x41, +0x1e, -0x29, +0x66,
+0x51, -0x3f, +0x47, +0x56, -0x60, +0x61, -0x2a, +0x62,
-0x0b, -0x80, -0x01, +0x4d, -0x1c, +0x3b, +0x49, -0x06,
-0x7e, -0x28, +0x0a, +0x4b, -0x80, -0x08, +0x43, +0x4a,
)
val actual = function.hash(ByteArray(0))
assertContentEquals(expected, actual)
}
}