Skip to content

Instantly share code, notes, and snippets.

@stefandeml
Last active December 18, 2021 11:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefandeml/7521446196b3663f53120b3f26399c53 to your computer and use it in GitHub Desktop.
Save stefandeml/7521446196b3663f53120b3f26399c53 to your computer and use it in GitHub Desktop.
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
proofOfOwnership(pkA, skA, context) == 1
// return hash
return hash(secret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment