implement tests
also fix MD5
This commit is contained in:
38
src/commonTest/kotlin/com/infendro/hash/sha2/SHA-384.kt
Normal file
38
src/commonTest/kotlin/com/infendro/hash/sha2/SHA-384.kt
Normal file
@@ -0,0 +1,38 @@
|
||||
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 = ubyteArrayOf(
|
||||
0x38U, 0xb0U, 0x60U, 0xa7U,
|
||||
0x51U, 0xacU, 0x96U, 0x38U,
|
||||
0x4cU, 0xd9U, 0x32U, 0x7eU,
|
||||
0xb1U, 0xb1U, 0xe3U, 0x6aU,
|
||||
0x21U, 0xfdU, 0xb7U, 0x11U,
|
||||
0x14U, 0xbeU, 0x07U, 0x43U,
|
||||
0x4cU, 0x0cU, 0xc7U, 0xbfU,
|
||||
0x63U, 0xf6U, 0xe1U, 0xdaU,
|
||||
0x27U, 0x4eU, 0xdeU, 0xbfU,
|
||||
0xe7U, 0x6fU, 0x65U, 0xfbU,
|
||||
0xd5U, 0x1aU, 0xd2U, 0xf1U,
|
||||
0x48U, 0x98U, 0xb9U, 0x5bU,
|
||||
)
|
||||
val actual = function.hash(
|
||||
ubyteArrayOf()
|
||||
)
|
||||
assertContentEquals(expected, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user