Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
#!/usr/bin/env bash | |
set -xeuo pipefail | |
# Cleanup | |
set +e | |
umount /mnt/boot | |
umount /mnt | |
vgchange -an vgnvme | |
set -e |
This file contains hidden or 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
# Create partitions | |
parted --script /dev/nvme0n1 mklabel gpt | |
parted --script --align optimal /dev/nvme0n1 -- mklabel gpt mkpart 'ESP-partition' fat32 1MB 551MB set 1 esp on mkpart 'LVM-partition' 551MB '100%' | |
partprobe | |
udevadm settle --timeout=5 --exit-if-exists=/dev/nvme0n1p1 | |
udevadm settle --timeout=5 --exit-if-exists=/dev/nvme0n1p2 | |
# Cleanup | |
wipefs -a /dev/nvme0n1p1 | |
wipefs -a /dev/nvme0n1p2 | |
set +e |
This file contains hidden or 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
def main(field a, field b) -> (field): | |
field result = a + b | |
return result |
This file contains hidden or 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/babyjubjubParams.code" as context | |
// Add two points on a twisted Edwards curve | |
// Curve parameters are defined with the last argument | |
// https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Addition_on_twisted_Edwards_curves | |
def main(field[2] pt1, field[2] pt2, field[10] context) -> (field[2]): | |
field a = context[0] | |
field d = context[1] | |
field u1 = pt1[0] |
This file contains hidden or 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/babyjubjubParams.code" as context | |
import "ecc/proofOfOwnership.code" as proofOfOwnership | |
import "hashes/sha256/512bitPacked.code" as sha256packed | |
def proofOfKnowledge(private field[4] secret, field[2] hash) -> (field): | |
// check that the computed hash matches the input | |
hash == sha256packed(secret) | |
return 1 | |
def main(field[2] pkA, field[2] pkB, field[2] hash, private field skA, private field[4] secret, private field skB) -> (field): |
This file contains hidden or 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/babyjubjubParams.code" as context | |
import "ecc/proofOfOwnership.code" as proofOfOwnership | |
import "hashes/sha256/512bitPacked.code" as sha256packed | |
def hash(private field[4] secret) -> (field[2]): | |
return sha256packed(secret) | |
def main(field[2] pkA, private field[4] secret, private field skA) -> (field[2]): | |
// load BabyJubJub context | |
context = context() | |
// prove ownership of skA |
This file contains hidden or 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/babyjubjubParams.code" as context | |
import "ecc/proofOfOwnership.code" as proofOfOwnership | |
import "hashes/sha256/512bitPacked.code" as sha256packed | |
def proofOfKnowledge(private field i1, private field i2, private field i3, private field i4, field h0, field h1) -> (field): | |
digest = sha256packed([i1, i2, i3, i4]) | |
digest[0] == h0 | |
digest[1] == h1 | |
return 1 |
This file contains hidden or 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/babyjubjubParams.code" as context | |
import "ecc/proofOfOwnership.code" as proofOfOwnership | |
import "hashes/sha256/512bitPacked.code" as sha256packed | |
def proofOfKnowledge(private field i1, private field i2, private field i3, private field i4, field h0, field h1) -> (field): | |
digest = sha256packed([i1, i2, i3, i4]) | |
digest[0] == h0 | |
digest[1] == h1 | |
return 1 |
This file contains hidden or 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
%load_ext autoreload | |
%autoreload 2 | |
# %% | |
import hashlib | |
from zokrates.eddsa import PrivateKey, PublicKey | |
from zokrates.field import FQ | |
from zokrates.utils import write_for_zokrates_cli | |
NewerOlder