Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

tasks:
- init: cargo build
command: cargo watch -x run


1 change: 1 addition & 0 deletions changelogs/unreleased/1321-only4sim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added Pedersen commitment int stdlib based on ECC.
22 changes: 22 additions & 0 deletions zokrates_stdlib/stdlib/commitments/pedersen/512bit.zok
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from "ecc/babyjubjubParams" import BabyJubJubParams;
import "ecc/edwardsAdd" as add;
import "ecc/edwardsScalarMult" as multiply;
import "utils/pack/bool/unpack256" as unpack256;


// Committing a value on a field to a twisted Edwards curve via Pedersen Commitment.
// Curve parameters are defined with the last argument
// https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Addition_on_twisted_Edwards_curves
// The parameter input is the value to be committed, and r is the blinding factor. The output is the corresponding pedersen commit, a point on the curve.

def main(field input, field r, BabyJubJubParams context) -> field[2] {
field[2] G = [context.Gu, context.Gv];

bool[256] inputBits = unpack256(input);
bool[256] rBits = unpack256(r);

field[2] inputExp = multiply(inputBits, G, context);
field[2] rExp = multiply(rBits, G, context);

return add(inputExp, rExp, context);
}