BlsEx (bls_ex v0.1.0)

BlsEx provides utility to leverage BLS signatures

BLS scheme supports aggregation of public keys and aggregation of signatures.

Here an full example of aggregated signature verification

iex> seed = :crypto.hash(:sha512, "myseed")
iex> public_key1 = BlsEx.get_public_key(seed)
iex> signature1 = BlsEx.sign(seed, "hello")
iex> seed2 = :crypto.hash(:sha512, "myseed2")
iex> public_key2 = BlsEx.get_public_key(seed2)
iex> signature2 = BlsEx.sign(seed2, "hello")
iex> aggregated_signature = BlsEx.aggregate_signatures([signature1, signature2], [public_key1, public_key2])
iex> aggregated_public_key = BlsEx.aggregate_public_keys([public_key1, public_key2])
iex> BlsEx.verify_signature(aggregated_public_key, "hello", aggregated_signature)
true

Summary

Functions

Aggregate a list of public keys

Aggregate a list of signatures

Generate a public key from a secret key

Sign a message using the given secret key

Verifies a single BLS signature

Types

Link to this type

public_key()

@type public_key() :: <<_::48>>
Link to this type

secret_key()

@type secret_key() :: <<_::512>>
@type signature() :: <<_::96>>

Functions

Link to this function

aggregate_public_keys(public_keys)

@spec aggregate_public_keys([public_key()]) :: public_key()

Aggregate a list of public keys

Link to this function

aggregate_signatures(signatures, public_keys)

@spec aggregate_signatures([signature()], [public_key()]) :: signature()

Aggregate a list of signatures

Link to this function

get_public_key(secret_key)

@spec get_public_key(secret_key :: secret_key()) :: public_key()

Generate a public key from a secret key

Link to this function

sign(secret_key, data)

@spec sign(secret_key :: secret_key(), message :: binary()) :: signature()

Sign a message using the given secret key

Link to this function

verify_signature(public_key, message, signature)

@spec verify_signature(
  public_key :: public_key(),
  message :: binary(),
  signature :: signature()
) :: boolean()

Verifies a single BLS signature