Ed25519 v1.1.0 Ed25519 View Source

Ed25519 signature functions

This is mostly suitable as part of a pure Elixir solution.

Configuration

No configuration is needed in most cases. However, if needed, a custom hash function can be configured. As per the specification - sha512 is the default.

config/config.exs

use Mix.Config

# The hash function will be invoked as 'Blake2.hash2b(payload, 16)'
config :ed25519,
  hash_fn: {Blake2, :hash2b, [], [16]}

# The hash function will be invoked as ':crypto.hash(:sha256, payload)'
config :ed25519,
  hash_fn: {:crypto, :hash, [:sha256], []}

Link to this section Summary

Types

public or secret key

computed signature

Functions

derive the public signing key from the secret key

Generate a secret/public key pair

validate a signed message

Link to this section Types

Link to this type key() View Source
key() :: binary()

public or secret key

Link to this type signature() View Source
signature() :: binary()

computed signature

Link to this section Functions

Link to this function derive_public_key(sk) View Source
derive_public_key(key()) :: key()

derive the public signing key from the secret key

Link to this function generate_key_pair() View Source
generate_key_pair() :: {key(), key()}

Generate a secret/public key pair

Returned tuple contains {random_secret_key, derived_public_key}

Link to this function signature(m, sk, pk \\ nil) View Source
signature(binary(), key(), key()) :: signature()

Sign a message

If only the secret key is provided, the public key will be derived therefrom. This adds significant overhead.

Link to this function valid_signature?(s, m, pk) View Source
valid_signature?(signature(), binary(), key()) :: boolean()

validate a signed message