refactor padding
This commit is contained in:
@@ -53,11 +53,11 @@ open class Keccak(
|
||||
|
||||
private fun pad(value: ByteArray): ByteArray {
|
||||
val size = (value.size + 2).align(block)
|
||||
val result = ByteArray(size)
|
||||
value.copyInto(result)
|
||||
result[value.size] = domain
|
||||
result[result.lastIndex] = 0x80U.toByte()
|
||||
return result
|
||||
return ByteArray(size).also {
|
||||
value.copyInto(it)
|
||||
it[value.size] = domain
|
||||
it[size - 1] = 0x80U.toByte()
|
||||
}
|
||||
}
|
||||
|
||||
private fun absorb(state: LongArray, value: ByteArray, offset: Int, w: LongArray) {
|
||||
|
||||
Reference in New Issue
Block a user