refactor math utility
All checks were successful
/ test (pull_request) Successful in 32s

This commit is contained in:
2026-01-17 15:44:50 +01:00
parent 62d6b8b01e
commit 4331145c34
12 changed files with 26 additions and 27 deletions

View File

@@ -5,7 +5,7 @@ import com.infendro.bytes.bytearray.copyInto
import com.infendro.bytes.intarray.copyInto
import com.infendro.bytes.ulong.copyInto
import com.infendro.hash.HashFunction
import com.infendro.hash.util.ceilPow2
import com.infendro.hash.util.align
object MD5 : HashFunction {
override val bytes: Int
@@ -64,7 +64,7 @@ object MD5 : HashFunction {
private fun pad(value: ByteArray): ByteArray {
val length = value.size.toULong() * 8UL
val size = ceilPow2(value.size + 9, block)
val size = (value.size + 9).align(block)
val result = ByteArray(size)
value.copyInto(result)
result[value.size] = 0x80U.toByte()