35 lines
906 B
Kotlin
35 lines
906 B
Kotlin
package com.infendro.hash.blake2
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class `Blake2s-256 Test` {
|
|
val function = Blake2s(32)
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(32, function.bytes)
|
|
assertEquals(256, function.bits)
|
|
assertEquals(64, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = ubyteArrayOf(
|
|
0x69U, 0x21U, 0x7aU, 0x30U,
|
|
0x79U, 0x90U, 0x80U, 0x94U,
|
|
0xe1U, 0x11U, 0x21U, 0xd0U,
|
|
0x42U, 0x35U, 0x4aU, 0x7cU,
|
|
0x1fU, 0x55U, 0xb6U, 0x48U,
|
|
0x2cU, 0xa1U, 0xa5U, 0x1eU,
|
|
0x1bU, 0x25U, 0x0dU, 0xfdU,
|
|
0x1eU, 0xd0U, 0xeeU, 0xf9U,
|
|
).asByteArray()
|
|
val actual = function.hash(
|
|
ByteArray(0),
|
|
)
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|