Skip to content

Commit

Permalink
Replace Blake2s example with smaller range example
Browse files Browse the repository at this point in the history
  • Loading branch information
lopeetall committed Feb 21, 2023
1 parent ecbecb7 commit e5ae00f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 233 deletions.
233 changes: 0 additions & 233 deletions test/blake2s.pir

This file was deleted.

27 changes: 27 additions & 0 deletions test/range.pir
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Any value 0 <= x < 32 such that the last two bits 1, 0 is valid. For example
10 is valid since its bit string is ...1010. Run as follows:
vamp-ir setup -o params.pp
vamp-ir compile -u params.pp -s tests/range.pir -o circuit.plonk
vamp-ir prove -u params.pp -c circuit.plonk -o proof.plonk
vamp-ir verify -u params.pp -c circuit.plonk -p proof.plonk
*/

pub x;

// Ensure that the given argument is 1 or 0, and returns it

def bool x = { x*(x-1) = 0; x };

// Extract 5 bits from a number argument

def bits5 a = {
def a0 = bool (fresh ((a\1) % 2));
def a1 = bool (fresh ((a\2) % 2));
def a2 = bool (fresh ((a\4) % 2));
def a3 = bool (fresh ((a\8) % 2));
def a4 = bool (fresh ((a\16) % 2));
a = a0 + 2*a1 + 4*a2 + 8*a3 + 16*a4;
(a0, a1, a2, a3, a4, ())
};

def x_bits = bits5 x;

0 comments on commit e5ae00f

Please sign in to comment.