29 lines
792 B
Kotlin
29 lines
792 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 = byteArrayOf(
|
|
+0x1f, -0x5f, +0x29, +0x1e, +0x65, +0x24, -0x75, +0x37,
|
|
-0x4d, +0x43, +0x34, +0x75, -0x4e, -0x60, -0x23, +0x63,
|
|
-0x2b, +0x4a, +0x11, -0x14, -0x3c, -0x1d, -0x20, +0x34,
|
|
-0x19, -0x44, +0x1e, -0x0c,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|