Erlang and ed25519

2021-06-10 13:18:00 +0000 erlang cryptography

Erlang/OTP 24.0 added support for ed25519 curves. Here’s some example snippets:

Generating a keypair

{Pub, Priv} = crypto:generate_key(eddsa, ed25519).

Signing some data

Challenge = crypto:strong_rand_bytes(1024).
Sig = public_key:sign(Challenge, ignored, {ed_pri, ed25519, Pub, Priv}, []).

Verifying a signature

true = public_key:verify(Challenge, ignored, Sig, {ed_pub, ed25519, Pub}).