18 lines
368 B
Kotlin
18 lines
368 B
Kotlin
package com.infendro.hash
|
|
|
|
interface HashFunction {
|
|
val bytes: Int
|
|
val bits: Int
|
|
get() = bytes * 8
|
|
|
|
val block: Int
|
|
|
|
fun hashInto(value: ByteArray, destination: ByteArray, destinationOffset: Int = 0)
|
|
|
|
fun hash(value: ByteArray): ByteArray {
|
|
val result = ByteArray(bytes)
|
|
hashInto(value, result)
|
|
return result
|
|
}
|
|
}
|