Skip to content

Commit

Permalink
fix: aligned hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
HashMapsData2Value committed Feb 22, 2024
1 parent 4e85e47 commit 881075b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/main/kotlin/bip32ed25519/ContextualApiCrypto.kt
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class ContextualApiCrypto(private var seed: ByteArray) {
val publicKey = this.lazySodium.cryptoScalarMultEd25519BaseNoclamp(scalar).toBytes()

// \(2): r = hash(c + msg) mod q [LE]
val rHash = MessageDigest.getInstance("SHA-512").digest(c + data).reversedArray()
val rHash = MessageDigest.getInstance("SHA-512").digest(c + data)
val r = this.lazySodium.cryptoCoreEd25519ScalarReduce(rHash).toByteArray().reversedArray()

// \(4): R = r * G (base point, no clamp)
Expand All @@ -380,6 +380,7 @@ class ContextualApiCrypto(private var seed: ByteArray) {
)
.toByteArray()
.reversedArray()

return R + S
}

Expand Down

0 comments on commit 881075b

Please sign in to comment.