improve docs
This commit is contained in:
parent
133919b77e
commit
b983a57fe4
4 changed files with 51 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
// Parameters are based on: https://github.com/HarryR/ethsnarks/tree/master/src/jubjub
|
||||
// Note: paramters will be update soon to be more compatible with zCash's implementation
|
||||
// Note: parameters will be update soon to be more compatible with zCash's implementation
|
||||
def main() -> (field[10]):
|
||||
|
||||
// Order of the curve E
|
||||
|
|
|
@ -4,7 +4,7 @@ import "utils/pack/unpack256.code" as unpack256
|
|||
// Verifies that the point is not one of the low-order points.
|
||||
// If any of the points is multiplied by the cofactor, the resulting point
|
||||
// will be infinity.
|
||||
// Returns ture if the point is not one of the low-order points.
|
||||
// Returns true if the point is not one of the low-order points, false otherwise.
|
||||
// Curve parameters are defined with the last argument
|
||||
// https://github.com/zcash-hackworks/sapling-crypto/blob/master/src/jubjub/edwards.rs#L166
|
||||
def main(field[2] pt, field[10] context) -> (field):
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
import "ecc/edwardsAdd.code" as add
|
||||
import "ecc/edwardsScalarMult.code" as multiply
|
||||
import "utils/pack/unpack256.code" as unpack256
|
||||
// Gadget to proof ownership of a private key for a given public key
|
||||
// Returns true for a valid public and private key pair, false otherwise
|
||||
// Curve parameters are defined with the last argument
|
||||
|
||||
/// Verifies correctness of a given public/private keypair.
|
||||
///
|
||||
/// Checks if the following equation holds for the provided keypair:
|
||||
/// pk = sk*G
|
||||
/// where G is the chosen base point of the subgroup
|
||||
/// and * is denotes scalar multiplication
|
||||
///
|
||||
/// Arguments:
|
||||
/// pk: Curve point. Public key.
|
||||
/// sk: Field element. Private key.
|
||||
/// context: Curve parameters (including generator G) used to create keypair.
|
||||
///
|
||||
/// Returns:
|
||||
/// Return true for pk/sk being a valid keypair, false otherwise.
|
||||
def main(field[2] pk, field sk, field[10] context) -> (field):
|
||||
|
||||
field[2] G = [context[4], context[5]]
|
||||
|
|
|
@ -5,8 +5,24 @@ import "utils/pack/unpack256.code" as unpack256
|
|||
import "ecc/edwardsOnCurve.code" as onCurve
|
||||
import "ecc/edwardsOrderCheck.code" as orderCheck
|
||||
|
||||
// Return true for a valid EdDSA Signature, false otherwise
|
||||
// Curve parameters are defined with the last argument
|
||||
/// Verifies the correctness of EdDSA Signature.
|
||||
///
|
||||
/// Checks the correctness of a given EdDSA Signature (R,S) for the provided
|
||||
/// public key(A) and message (M0 and M1).
|
||||
/// For more information see:
|
||||
/// https://en.wikipedia.org/wiki/EdDSA
|
||||
/// https://eprint.iacr.org/2015/677.pdf
|
||||
///
|
||||
/// Arguments:
|
||||
/// R: Curve point. Hidden version of the per-message nonce.
|
||||
/// S: Field element. Signature to be verified.
|
||||
/// A: Curve point. Public part of the key used to create S.
|
||||
/// M0: 256bit array. First 256bits of the message used to create S .
|
||||
/// M1: 256bit array. Trailing 256bits of the message used to create S .
|
||||
/// context: Curve parameters used to create S.
|
||||
///
|
||||
/// Returns:
|
||||
/// Return true for S being a valid EdDSA Signature, false otherwise.
|
||||
def main(private field[2] R, private field S, field[2] A, field[256] M0, field[256] M1, field[10] context) -> (field):
|
||||
|
||||
field[2] G = [context[4], context[5]]
|
||||
|
|
Loading…
Reference in a new issue