This commit is contained in:
@@ -12,24 +12,23 @@ object `Blake-224` : HashFunction {
|
||||
override val block: Int
|
||||
get() = 64
|
||||
|
||||
private val initial = uintArrayOf(
|
||||
0xc1059ed8U, 0x367cd507U,
|
||||
0x3070dd17U, 0xf70e5939U,
|
||||
0xffc00b31U, 0x68581511U,
|
||||
0x64f98fa7U, 0xbefa4fa4U,
|
||||
).asIntArray()
|
||||
private val initial = intArrayOf(
|
||||
-0x3efa6128, +0x367cd507,
|
||||
+0x3070dd17, -0x08f1a6c7,
|
||||
-0x003ff4cf, +0x68581511,
|
||||
+0x64f98fa7, -0x4105b05c,
|
||||
)
|
||||
|
||||
override fun hashInto(value: ByteArray, destination: ByteArray, destinationOffset: Int) {
|
||||
val length = value.size.toULong() * 8UL
|
||||
val input = pad(value)
|
||||
val h = initial.copyOf()
|
||||
val m = IntArray(16)
|
||||
val v = IntArray(16)
|
||||
var t = 0U
|
||||
|
||||
for (i in input.indices step block) {
|
||||
t += minOf(length - t, 512UL).toUInt()
|
||||
`Blake-256`.compress(h, input, i, m, v, t)
|
||||
val block = input.sliceArray(i..<(i + block))
|
||||
`Blake-256`.compress(h, block, t)
|
||||
}
|
||||
h.copyInto(destination, destinationOffset, endIndex = 7)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user