refactor padding

This commit is contained in:
2026-01-22 12:44:59 +01:00
parent 5547e77c58
commit e138ec0b6d
11 changed files with 53 additions and 53 deletions

View File

@@ -63,12 +63,12 @@ object `Blake-512` : HashFunction {
val length = value.size.toULong() * 8UL
val size = (value.size + 18).align(block)
val result = ByteArray(size)
value.copyInto(result)
result[value.size] = 0x80U.toByte()
result[result.size - 17] = 0x01
length.copyInto(result, result.size - 8)
return result
return ByteArray(size).also {
value.copyInto(it)
it[value.size] = 0x80U.toByte()
it[size - 17] = 0x01
length.copyInto(it, size - 8)
}
}
internal fun compress(h: LongArray, value: ByteArray, offset: Int, m: LongArray, v: LongArray, t: ULong) {