keyx v0.3.1 KeyX

Documentation for KeyX.

Link to this section Summary

Functions

Generate secret shares using Shamir’s Secret Sharing alrgorithm

Recover secrets from an appropriate number of shares. Must be equal or greater than the K parameters

Link to this section Functions

Link to this function generate_shares(k, n, shares)
generate_shares(k :: pos_integer, n :: pos_integer, secret :: String.t) :: [binary, ...]

Generate secret shares using Shamir’s Secret Sharing alrgorithm.

Parameters

  • K: specifies the number of shares necessary to recover the secret.
  • N: is the identifier of the share and varies between 1 and n where n is the total number of generated shares.
  • Secret: Binary (String) of raw secret to split N ways, requiring K shares to recover.

Examples

iex> KeyX.generate_shares(1,2, "super duper secret")
{:ok, ["1-1-c3VwZXIgZHVwZXIgc2VjcmV0", "1-2-c3VwZXIgZHVwZXIgc2VjcmV0"]}
Link to this function recover_secret(shares)
recover_secret(shares :: [String.t, ...]) :: binary

Recover secrets from an appropriate number of shares. Must be equal or greater than the K parameters.

Parameters

  • Shares: List of shares (Base64 encoding) containing information about the share, and if signed, the signature.

Examples

iex> KeyX.recover_secret(["1-2-c3VwZXIgZHVwZXIgc2VjcmV0", "1-2-c3VwZXIgZHVwZXIgc2VjcmV0"])
{:ok, "super duper secret"}