1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_stdlib/stdlib/ecc/jubjub.zok
2023-10-04 18:33:09 +02:00

26 lines
No EOL
937 B
Text

#pragma curve bls12_381
import "./proofOfOwnership" as edwardsProofOfOwnership;
import "./verifyEddsa" as edwardsSignature;
// The `a` coefficient of the twisted Edwards curve
const field EDWARDS_A = -1;
// The `d` coefficient of the twisted Edwards curve (-10240/10241 mod p)
const field EDWARDS_D = 19257038036680949359750312669786877991949435402254120286184196891950884077233;
// The generator point
const field[2] G = [
11076627216317271660298050606127911965867021807910416450833192264015104452986, // Gx
44412834903739585386157632289020980010620626017712148233229312325549216099227 // Gy
];
const u32 bit_size = 255;
def proofOfOwnership(field[2] pk, field sk) -> bool {
return edwardsProofOfOwnership(pk, sk, G, EDWARDS_A, EDWARDS_D, bit_size);
}
def verifyEddsa(field[2] R, field S, field[2] A, u32[8] M0, u32[8] M1) -> bool {
return edwardsSignature(R, S, A, M0, M1, G, EDWARDS_A, EDWARDS_D, bit_size);
}