Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.75 KB

File metadata and controls

63 lines (40 loc) · 1.75 KB

ShamirSSS.jl

A Julia package implementing Shamir's Secret Sharing Scheme.

Overview

Shamir's Secret Sharing Scheme is a cryptographic technique for securely sharing a secret among multiple parties. This package provides two primary functions:

  • split_secret: splits a secret string into multiple shares, with a specified threshold required for reconstruction.
  • reconstruct_secret: reconstructs the original secret string from a set of shares.

Installation

To use this package, add the following line to your Julia REPL:

Pkg.add("ShamirSSS")

Usage

Splitting a Secret

To split a secret string into shares, use the split_secret function:

using ShamirSSS

secret = "my_secret_string"
n = 5  # number of shares
t = 3  # threshold required for reconstruction

shares = split_secret(secret, n, t)

This will generate a vector of n shares, each represented as a serialized string.

Reconstructing a Secret

To reconstruct the original secret string from a set of shares, use the reconstruct_secret function:

reconstructed_secret = reconstruct_secret(shares[[5,2,3]])

This will return the original secret string.

Parameters

  • secret: the secret string to be split (required)
  • n: the number of shares to generate (required)
  • t: the minimum number of shares required to reconstruct the secret (required)
  • prime_bits: the number of bits for the prime modulus (optional, default: 4096)

Returns

  • split_secret: a vector of serialized share strings
  • reconstruct_secret: the reconstructed secret string

Example Use Cases

  • Securely sharing a password among multiple team members
  • Distributing a cryptographic key among multiple servers
  • Creating a backup of sensitive data using multiple shares