This commit is contained in:
@@ -10,21 +10,20 @@ object `SHA-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 input = `SHA-256`.pad(value)
|
||||
val h = initial.copyOf()
|
||||
val w = IntArray(64)
|
||||
val v = IntArray(8)
|
||||
|
||||
for (i in input.indices step block) {
|
||||
`SHA-256`.process(h, input, i, w, v)
|
||||
val block = input.sliceArray(i..<(i + block))
|
||||
`SHA-256`.process(h, block)
|
||||
}
|
||||
h.copyInto(destination, destinationOffset, endIndex = 7)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user