implement optimizations
This commit is contained in:
@@ -7,7 +7,20 @@ interface HashFunction {
|
||||
|
||||
val block: Int
|
||||
|
||||
fun hash(
|
||||
value: UByteArray,
|
||||
): UByteArray
|
||||
fun hashInto(value: ByteArray, destination: ByteArray)
|
||||
|
||||
fun hashInto(value: ByteArray, destination: UByteArray) =
|
||||
hashInto(value, destination.asByteArray())
|
||||
|
||||
fun hashInto(value: UByteArray, destination: UByteArray) =
|
||||
hashInto(value.asByteArray(), destination.asByteArray())
|
||||
|
||||
fun hashInto(value: UByteArray, destination: ByteArray) =
|
||||
hashInto(value.asByteArray(), destination)
|
||||
|
||||
fun hash(value: ByteArray): ByteArray =
|
||||
ByteArray(bytes).also { hashInto(value, it) }
|
||||
|
||||
fun hash(value: UByteArray): UByteArray =
|
||||
UByteArray(bytes).also { hashInto(value, it) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user