29 lines
786 B
Kotlin
29 lines
786 B
Kotlin
package com.infendro.hash.sha2
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class `SHA-224_Test` {
|
|
val function = `SHA-224`()
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(28, function.bytes)
|
|
assertEquals(224, function.bits)
|
|
assertEquals(64, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = byteArrayOf(
|
|
-0x2f, +0x4a, +0x02, -0x74, +0x2a, +0x3a, +0x2b, -0x37,
|
|
+0x47, +0x61, +0x02, -0x45, +0x28, -0x7e, +0x34, -0x3c,
|
|
+0x15, -0x5e, -0x50, +0x1f, -0x7e, -0x72, -0x5a, +0x2a,
|
|
-0x3b, -0x4d, -0x1c, +0x2f,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|