Skip to content

Instantly share code, notes, and snippets.

⛷️
Winter Season.

Stefan stefandeml

⛷️
Winter Season.
  • Zurich, Switzerland
Block or report user

Report or block stefandeml

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Contacts.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:0acbdc40c866f59949844c79e9bbc3de
#!/usr/bin/env bash
set -xeuo pipefail
# Cleanup
set +e
umount /mnt/boot
umount /mnt
vgchange -an vgnvme
set -e
View gist:587a8b5bf596e7347751708ca762a30e
# 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
View ZoKrates Example
def main(field a, field b) -> (field):
field result = a + b
return result
View ZoKrates Twisted Edwards Curve Addition
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]
@stefandeml
stefandeml / ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
Created Apr 8, 2019
ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
View ZoKrates non-Repudiable Identity-Linked Proofs of Knowledge
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):
@stefandeml
stefandeml / ZoKrates Identity-linked Proof of Knowledge
Last active Apr 8, 2019
ZoKrates Identity-linked Proof of Knowledge
View ZoKrates Identity-linked Proof of Knowledge
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
View thridexample.go
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
View test.go
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
View gist:159a5d27aa66c08e56cc8416d8763e64
%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
You can’t perform that action at this time.