33 lines
1.1 KiB
Kotlin
33 lines
1.1 KiB
Kotlin
package com.infendro.hash.keccak.sha3
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class `SHA3-512_Test` {
|
|
val function = `SHA3-512`()
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(64, function.bytes)
|
|
assertEquals(512, function.bits)
|
|
assertEquals(72, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = byteArrayOf(
|
|
-0x5a, -0x61, +0x73, -0x34, -0x5e, +0x3a, -0x66, -0x3b,
|
|
-0x38, -0x4b, +0x67, -0x24, +0x18, +0x5a, +0x75, +0x6e,
|
|
-0x69, -0x37, -0x7e, +0x16, +0x4f, -0x1e, +0x58, +0x59,
|
|
-0x20, -0x2f, -0x24, -0x3f, +0x47, +0x5c, -0x80, -0x5a,
|
|
+0x15, -0x4e, +0x12, +0x3a, -0x0f, -0x0b, -0x07, +0x4c,
|
|
+0x11, -0x1d, -0x17, +0x40, +0x2c, +0x3a, -0x3b, +0x58,
|
|
-0x0b, +0x00, +0x19, -0x63, -0x6b, -0x4a, -0x2d, -0x1d,
|
|
+0x01, +0x75, -0x7b, -0x7a, +0x28, +0x1d, -0x33, +0x26,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|