33 lines
1.1 KiB
Kotlin
33 lines
1.1 KiB
Kotlin
package com.infendro.hash.keccak.shake
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class SHAKE256_Test {
|
|
val function = SHAKE256(64)
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(64, function.bytes)
|
|
assertEquals(512, function.bits)
|
|
assertEquals(136, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = byteArrayOf(
|
|
+0x46, -0x47, -0x23, +0x2b, +0x0b, -0x58, -0x73, +0x13,
|
|
+0x23, +0x3b, +0x3f, -0x15, +0x74, +0x3e, -0x15, +0x24,
|
|
+0x3f, -0x33, +0x52, -0x16, +0x62, -0x48, +0x1b, -0x7e,
|
|
-0x4b, +0x0c, +0x27, +0x64, +0x6e, -0x2b, +0x76, +0x2f,
|
|
-0x29, +0x5d, -0x3c, -0x23, -0x28, -0x40, -0x0e, +0x00,
|
|
-0x35, +0x05, +0x01, -0x63, +0x67, -0x4b, -0x6e, -0x0a,
|
|
-0x04, -0x7e, +0x1c, +0x49, +0x47, -0x66, -0x4c, -0x7a,
|
|
+0x40, +0x29, +0x2e, -0x54, -0x4d, -0x49, -0x3c, -0x42,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|