-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1091 from Zokrates/rc/0.7.11
Release 0.7.11
- Loading branch information
Showing
38 changed files
with
1,168 additions
and
7,035 deletions.
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "zokrates_cli" | ||
version = "0.7.10" | ||
version = "0.7.11" | ||
authors = ["Jacob Eberhardt <[email protected]>", "Dennis Kuhnert <[email protected]>", "Thibaut Schaeffer <[email protected]>"] | ||
repository = "https://github.com/Zokrates/ZoKrates.git" | ||
edition = "2018" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
import "hashes/pedersen/512bit" as hash | ||
import "ecc/edwardsCompress" as edwardsCompress | ||
import "hashes/utils/256bitsDirectionHelper" as multiplex | ||
|
||
// Merke-Tree inclusion proof for tree depth 3 using SNARK efficient pedersen hashes | ||
// directionSelector=> true if current digest is on the rhs of the hash | ||
const u32 DEPTH = 3 | ||
|
||
def main(u32[8] rootDigest, private u32[8] leafDigest, private bool[3] directionSelector, u32[8] PathDigest0, private u32[8] PathDigest1, private u32[8] PathDigest2): | ||
//Setup | ||
u32[8] currentDigest = leafDigest | ||
|
||
//Loop up the tree | ||
u32[16] preimage = multiplex(directionSelector[0], currentDigest, PathDigest0) | ||
currentDigest = hash(preimage) | ||
// Merke-Tree inclusion proof for tree depth 4 using SNARK-efficient pedersen hashes | ||
// directionSelector => true if current digest is on the rhs of the hash | ||
|
||
preimage = multiplex(directionSelector[1], currentDigest, PathDigest1) | ||
currentDigest = hash(preimage) | ||
def main(u32[8] root, private u32[8] leaf, private bool[DEPTH] directionSelector, private u32[DEPTH][8] path) -> bool: | ||
// Start from the leaf | ||
u32[8] digest = leaf | ||
|
||
preimage = multiplex(directionSelector[2], currentDigest, PathDigest2) | ||
currentDigest = hash(preimage) | ||
// Loop up the tree | ||
for u32 i in 0..DEPTH do | ||
u32[16] preimage = multiplex(directionSelector[i], digest, path[i]) | ||
digest = hash(preimage) | ||
endfor | ||
|
||
assert(rootDigest == currentDigest) | ||
|
||
return | ||
return digest == root | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
import "hashes/sha256/512bit" as sha256 | ||
import "hashes/sha256/512bit" as hash | ||
import "hashes/utils/256bitsDirectionHelper" as multiplex | ||
|
||
def multiplex(bool selector, u32[8] left, u32[8] right) -> (u32[8]): | ||
return if selector then right else left fi | ||
const u32 DEPTH = 3 | ||
|
||
// Merkle-Tree inclusion proof for tree depth 3 | ||
def select(bool condition, u32[8] left, u32[8] right) -> (u32[8], u32[8]): | ||
return if condition then right else left fi, if condition then left else right fi | ||
|
||
def main(field treeDepth, u32[8] rootDigest, private u32[8] leafDigest, private bool[2] directionSelector, u32[8] PathDigest0, private u32[8] PathDigest1): | ||
// Merke-Tree inclusion proof for tree depth 4 using sha256 | ||
// directionSelector => true if current digest is on the rhs of the hash | ||
|
||
//Setup | ||
u32[8] currentDigest = leafDigest | ||
field counter = 1 | ||
bool currentDirection = false | ||
|
||
//Loop up the tree | ||
currentDirection = directionSelector[0] | ||
u32[8] lhs = multiplex(currentDirection, currentDigest, PathDigest0) | ||
u32[8] rhs = multiplex(!currentDirection, currentDigest, PathDigest0) | ||
currentDigest = sha256(lhs, rhs) | ||
counter = counter + 1 | ||
def main(u32[8] root, private u32[8] leaf, private bool[DEPTH] directionSelector, private u32[DEPTH][8] path) -> bool: | ||
// Start from the leaf | ||
u32[8] digest = leaf | ||
|
||
currentDirection = directionSelector[1] | ||
lhs = multiplex(currentDirection, currentDigest, PathDigest1) | ||
rhs = multiplex(!currentDirection, currentDigest, PathDigest1) | ||
currentDigest = sha256(lhs, rhs) | ||
counter = counter + 1 | ||
// Loop up the tree | ||
for u32 i in 0..DEPTH do | ||
u32[8] left, u32[8] right = select(directionSelector[i], digest, path[i]) | ||
digest = hash(left, right) | ||
endfor | ||
|
||
assert(counter == treeDepth) | ||
assert(rootDigest == currentDigest) | ||
return digest == root | ||
|
||
return |
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
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
Oops, something went wrong.