Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save davidp94/679fe693286b491fc80ff3448a8d7d45 to your computer and use it in GitHub Desktop.
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):
context = context()
field AhasKnowledge = proofOfKnowledge(secret, hash)
field AhasOwnership = proofOfOwnership(pkA, skA, context)
field BhasOwnership = proofOfOwnership(pkB, skB, context)
field isAwithKnowledge = if AhasKnowledge == 1 && AhasOwnership == 1 then 1 else 0 fi
field out = if isAwithKnowledge == 1 || BhasOwnership == 1 then 1 else 0 fi
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment