29 lines
823 B
Kotlin
29 lines
823 B
Kotlin
package com.infendro.hash.keccak.shake
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class SHAKE128_Test {
|
|
val function = SHAKE128(32)
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(32, function.bytes)
|
|
assertEquals(256, function.bits)
|
|
assertEquals(168, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = byteArrayOf(
|
|
+0x7f, -0x64, +0x2b, -0x5c, -0x18, -0x71, -0x7e, +0x7d,
|
|
+0x61, +0x60, +0x45, +0x50, +0x76, +0x05, -0x7b, +0x3e,
|
|
-0x29, +0x3b, -0x80, -0x6d, -0x0a, -0x11, -0x44, -0x78,
|
|
-0x15, +0x1a, +0x6e, -0x54, -0x06, +0x66, -0x11, +0x26,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|