Files
hash.kt/src/commonTest/kotlin/com/infendro/hash/sha1/SHA1.kt

32 lines
770 B
Kotlin

package com.infendro.hash.sha1
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `SHA1 Test` {
val function = SHA1
@Test
fun `bytes and block`() {
assertEquals(20, function.bytes)
assertEquals(160, function.bits)
assertEquals(64, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xdaU, 0x39U, 0xa3U, 0xeeU,
0x5eU, 0x6bU, 0x4bU, 0x0dU,
0x32U, 0x55U, 0xbfU, 0xefU,
0x95U, 0x60U, 0x18U, 0x90U,
0xafU, 0xd8U, 0x07U, 0x09U,
).asByteArray()
val actual = function.hash(
ByteArray(0),
)
assertContentEquals(expected, actual)
}
}