This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sudoku of format | |
// | a11 | a12 || b11 | b12 | | |
// -------------------------- | |
// | a21 | a22 || b21 | b22 | | |
// ========================== | |
// | c11 | c12 || d11 | d12 | | |
// -------------------------- | |
// | c21 | c22 || d21 | d22 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<prog> ::= <functions> | |
<functions> ::= <function> <functions> | |
<function> ::= `def' <ide> `(' <arguments> `):\\n' <stat-list> | |
<arguments> ::= <ide> <more-args> | $\varepsilon$ | |
<more-args> ::= `,' <ide> <more-args> | $\varepsilon$ | |
<stat-list> ::= <statement> <stat-list> | `return' <expressions> `\\n' | |
<expressions> ::= <expr> <more-expr> | $\varepsilon$ | |
<more-exprs> ::= `,' <ide> <more-args> | $\varepsilon$ | |
<statement> ::= <ide> <statement'> | |
| `if' <expr> <comparator> <expr> `then' <expr> `else' <expr> `fi' <expr'> `==' <expr> `\\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ZoKrates Grammar | |
* Author: Jacob Eberhardt | |
*/ | |
// TODO: | |
// exclude language keywords as identifiers | |
// Ignore linebreak after \ | |
// Skip Whitespaces and Block Comments and Line Comments | |
// associativit and precedence table for operators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "ecc/edwardsAdd.code" as add | |
import "ecc/edwardsScalarMult.code" as multiply | |
import "utils/pack/unpack256.code" as unpack256 | |
/// Verifies match 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 * denotes scalar multiplication in the subgroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "hashes/sha256/1024bitPadded.code" as sha256 | |
import "ecc/edwardsScalarMult.code" as scalarMult | |
import "ecc/edwardsAdd.code" as add | |
import "utils/pack/unpack256.code" as unpack256 | |
import "ecc/edwardsOnCurve.code" as onCurve | |
import "ecc/edwardsOrderCheck.code" as orderCheck | |
/// Verifies an EdDSA Signature. | |
/// | |
/// Checks the correctness of a given EdDSA Signature (R,S) for the provided |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
from zokrates.eddsa import PrivateKey, PublicKey | |
from zokrates.field import FQ | |
from zokrates.utils import write_for_zokrates_cli | |
if __name__ == "__main__": | |
raw_msg = "This is my secret message" | |
msg = hashlib.sha512(raw_msg.encode("utf-8")).digest() | |
# sk = PrivateKey.from_rand() | |
# Seeded for debug purpose | |
key = FQ(1997011358982923168928344992199991480689546837621580239342656433234255379025) |