34 lines
866 B
Kotlin
34 lines
866 B
Kotlin
package com.infendro.hash.blake2
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class `Blake2s-224 Test` {
|
|
val function = Blake2s(28)
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(28, function.bytes)
|
|
assertEquals(224, function.bits)
|
|
assertEquals(64, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = ubyteArrayOf(
|
|
0x1fU, 0xa1U, 0x29U, 0x1eU,
|
|
0x65U, 0x24U, 0x8bU, 0x37U,
|
|
0xb3U, 0x43U, 0x34U, 0x75U,
|
|
0xb2U, 0xa0U, 0xddU, 0x63U,
|
|
0xd5U, 0x4aU, 0x11U, 0xecU,
|
|
0xc4U, 0xe3U, 0xe0U, 0x34U,
|
|
0xe7U, 0xbcU, 0x1eU, 0xf4U,
|
|
).asByteArray()
|
|
val actual = function.hash(
|
|
ByteArray(0),
|
|
)
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|