mirror of
https://github.com/personaelabs/spartan-ecdsa.git
synced 2026-01-09 14:07:54 -05:00
Merge branch 'main' into test/ecc_circuits
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { hashPersonalMessage, ecsign } from "@ethereumjs/util";
|
||||
import { EffEcdsaCircuitPubInput } from "@personaelabs/spartan-ecdsa";
|
||||
import { computeEffEcdsaPubInput } from "@personaelabs/spartan-ecdsa";
|
||||
|
||||
export const getEffEcdsaCircuitInput = (privKey: Buffer, msg: Buffer) => {
|
||||
const msgHash = hashPersonalMessage(msg);
|
||||
const { v, r: _r, s } = ecsign(msgHash, privKey);
|
||||
const r = BigInt("0x" + _r.toString("hex"));
|
||||
|
||||
const circuitPubInput = EffEcdsaCircuitPubInput.computeFromSig(r, v, msgHash);
|
||||
const circuitPubInput = computeEffEcdsaPubInput(r, v, msgHash);
|
||||
const input = {
|
||||
s: BigInt("0x" + s.toString("hex")),
|
||||
Tx: circuitPubInput.Tx,
|
||||
|
||||
@@ -2,10 +2,10 @@ import {
|
||||
CircuitPubInput,
|
||||
PublicInput,
|
||||
verifyEffEcdsaPubInput
|
||||
} from "../src/helpers/efficient_ecdsa";
|
||||
} from "../src/helpers/public_input";
|
||||
import { hashPersonalMessage } from "@ethereumjs/util";
|
||||
|
||||
describe("efficient_ecdsa", () => {
|
||||
describe("public_input", () => {
|
||||
/**
|
||||
Hard coded values were computed in sage using the following code
|
||||
p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
|
||||
|
||||
Reference in New Issue
Block a user