I hereby claim:
- I am stefandeml on github.
- I am stefandeml (https://keybase.io/stefandeml) on keybase.
- I have a public key ASC5ycjMj6VU51NddaMg9r1ZYb9EofC81kilPNS7R9y6tgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| %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 | |
| 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 |
| 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 |
| 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 |
| 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): |
| 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] |
| def main(field a, field b) -> (field): | |
| field result = a + b | |
| return result |
| # 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 |
| #!/usr/bin/env bash | |
| set -xeuo pipefail | |
| # Cleanup | |
| set +e | |
| umount /mnt/boot | |
| umount /mnt | |
| vgchange -an vgnvme | |
| set -e |