31 lines
951 B
Kotlin
31 lines
951 B
Kotlin
package com.infendro.hash.sha2
|
|
|
|
import kotlin.test.Test
|
|
import kotlin.test.assertContentEquals
|
|
import kotlin.test.assertEquals
|
|
|
|
class `SHA-384_Test` {
|
|
val function = `SHA-384`()
|
|
|
|
@Test
|
|
fun `bytes and block`() {
|
|
assertEquals(48, function.bytes)
|
|
assertEquals(384, function.bits)
|
|
assertEquals(128, function.block)
|
|
}
|
|
|
|
@Test
|
|
fun `empty bytearray`() {
|
|
val expected = byteArrayOf(
|
|
+0x38, -0x50, +0x60, -0x59, +0x51, -0x54, -0x6a, +0x38,
|
|
+0x4c, -0x27, +0x32, +0x7e, -0x4f, -0x4f, -0x1d, +0x6a,
|
|
+0x21, -0x03, -0x49, +0x11, +0x14, -0x42, +0x07, +0x43,
|
|
+0x4c, +0x0c, -0x39, -0x41, +0x63, -0x0a, -0x1f, -0x26,
|
|
+0x27, +0x4e, -0x22, -0x41, -0x19, +0x6f, +0x65, -0x05,
|
|
-0x2b, +0x1a, -0x2e, -0x0f, +0x48, -0x68, -0x47, +0x5b,
|
|
)
|
|
val actual = function.hash(ByteArray(0))
|
|
assertContentEquals(expected, actual)
|
|
}
|
|
}
|