also fix MD5
This commit is contained in:
31
src/commonTest/kotlin/com/infendro/hash/sha1/SHA1.kt
Normal file
31
src/commonTest/kotlin/com/infendro/hash/sha1/SHA1.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
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,
|
||||
)
|
||||
val actual = function.hash(
|
||||
ubyteArrayOf()
|
||||
)
|
||||
assertContentEquals(expected, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user