1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_stdlib/stdlib/ecc/edwardsOnCurve.code
2019-03-15 18:04:57 +01:00

16 lines
463 B
Text

// Function checks if a provided point is on a twisted Edwards curve
// Curve parameters are defined with the last argument
// See appendix 3.3.1 of Zcash protocol specification:
// https://github.com/zcash/zips/blob/master/protocol/protocol.pdf
def main(field[2] pt, field[10] context) -> (field):
field a = context[0]
field d = context[1]
field uu = pt[0] * pt[0]
field vv = pt[1] * pt[1]
field uuvv = uu * vv
a * uu + vv == 1 + d * uuvv
return 1