Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save prihandi/4e31ad9e08b83f2ce0ff12999281687a to your computer and use it in GitHub Desktop.
Save prihandi/4e31ad9e08b83f2ce0ff12999281687a to your computer and use it in GitHub Desktop.
# Generate EDDSA public key and private key
{public_key, priv_key} = :crypto.generate_key(:eddsa, :ed25519)
# Payload that need to be signed
payload = "some_string"
# Generate signature with both public key and private key
signature = :public_key.sign(payload, :none, {:ed_pri, :ed25519, public_key, priv_key}, [])
# Verify signature with public key
is_verified = :public_key.verify(payload, :none, signature, {:ed_pub, :ed25519, public_key})
# DWYOR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment