convert HashFunction to interface
This commit is contained in:
@@ -6,16 +6,11 @@ import com.infendro.bytearray.toULongArray
|
||||
import com.infendro.hash.HashFunction
|
||||
import kotlin.math.min
|
||||
|
||||
open class Keccak(
|
||||
abstract class Keccak(
|
||||
override val bytes: Int,
|
||||
private val rate: Int,
|
||||
private val domain: UByte,
|
||||
) : HashFunction() {
|
||||
init {
|
||||
if (bytes < 1) throw IllegalArgumentException()
|
||||
if (rate !in 8..168) throw IllegalArgumentException()
|
||||
}
|
||||
|
||||
) : HashFunction {
|
||||
override val block: Int
|
||||
get() = rate
|
||||
|
||||
@@ -108,7 +103,7 @@ open class Keccak(
|
||||
}
|
||||
}
|
||||
|
||||
fun squeeze(
|
||||
private fun squeeze(
|
||||
state: ULongArray,
|
||||
): UByteArray {
|
||||
return buildList {
|
||||
|
||||
Reference in New Issue
Block a user