for r, dont use bigint but hex string
This commit is contained in:
@@ -21,14 +21,16 @@ async function hashToCurve(secretMessage) {
|
||||
|
||||
async function step1Alice(secretMessage) {
|
||||
const Y = await hashToCurve(secretMessage)
|
||||
const r = bytesToNumber(nobleSecp256k1.utils.randomPrivateKey())
|
||||
const rpk = nobleSecp256k1.utils.randomPrivateKey()
|
||||
const r = bytesToNumber(rpk)
|
||||
const P = nobleSecp256k1.Point.fromPrivateKey(r)
|
||||
const B_ = Y.add(P)
|
||||
return {B_: B_.toHex(true), r}
|
||||
return {B_: B_.toHex(true), r: nobleSecp256k1.utils.bytesToHex(rpk)}
|
||||
}
|
||||
|
||||
function step3Alice(C_, r, A) {
|
||||
const rInt = BigInt(r)
|
||||
// const rInt = BigInt(r)
|
||||
const rInt = bytesToNumber(r)
|
||||
const C = C_.subtract(A.multiply(rInt))
|
||||
return C
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user