Upgrade bytes-kt
All checks were successful
/ test (pull_request) Successful in 44s

This commit is contained in:
2026-02-14 16:32:50 +01:00
parent 902cb060a1
commit cb3ff7ec6c
13 changed files with 91 additions and 91 deletions

View File

@@ -1,7 +1,7 @@
package com.infendro.hash.blake
import com.infendro.bytes.intarray.copyInto
import com.infendro.bytes.ulong.copyInto
import com.infendro.bytes.long.copyInto
import com.infendro.hash.HashFunction
import com.infendro.hash.util.align
@@ -20,13 +20,13 @@ object `Blake-224` : HashFunction {
)
override fun hashInto(value: ByteArray, destination: ByteArray, destinationOffset: Int) {
val length = value.size.toULong() * 8UL
val length = value.size * 8L
val input = pad(value)
val h = initial.copyOf()
var t = 0U
var t = 0
for (i in input.indices step block) {
t += minOf(length - t, 512UL).toUInt()
t += minOf(length - t, 512).toInt()
val block = input.sliceArray(i..<(i + block))
`Blake-256`.compress(h, block, t)
}
@@ -34,12 +34,12 @@ object `Blake-224` : HashFunction {
}
private fun pad(value: ByteArray): ByteArray {
val length = value.size.toULong() * 8UL
val length = value.size * 8L
val size = (value.size + 9).align(block)
return ByteArray(size).also {
value.copyInto(it)
it[value.size] = 0x80U.toByte()
it[value.size] = -0x80
length.copyInto(it, size - 8)
}
}