An implementation of Shamir Secret Sharing in Gleam
Go to file
LilyRose2798 84b0261114 Initial commit 2024-06-24 18:18:06 +10:00
.github/workflows Initial commit 2024-06-24 18:18:06 +10:00
src Initial commit 2024-06-24 18:18:06 +10:00
test Initial commit 2024-06-24 18:18:06 +10:00
.gitignore Initial commit 2024-06-24 18:18:06 +10:00
LICENSE.md Initial commit 2024-06-24 18:18:06 +10:00
README.md Initial commit 2024-06-24 18:18:06 +10:00
gleam.toml Initial commit 2024-06-24 18:18:06 +10:00
manifest.toml Initial commit 2024-06-24 18:18:06 +10:00

README.md

shamir

Package Version Hex Docs

gleam add shamir
import shamir

pub fn main() {
  let secret = "testing123!"
  io.println("Original: " <> data)
  let share_res = shamir.share(data, 5, 3)
  let assert Ok([share_1, share_2, share_3, share_4, share_5]) = share_res
  io.println("Share 1: " <> share_1)
  io.println("Share 2: " <> share_2)
  io.println("Share 3: " <> share_3)
  io.println("Share 4: " <> share_4)
  io.println("Share 5: " <> share_5)
  let assert Ok(combined) = shamir.combine([share_1, share_3, share_5])
  io.println("Combined Shares: " <> combined)
  let assert Ok(share_new) = shamir.new_share(6, [share_1, share_3, share_4])
  io.println("New Share: " <> share_new)
  let assert Ok(new_combined) = shamir.combine([share_1, share_4, share_new])
  io.println("Combined New Shares: " <> new_combined)
}

Further documentation can be found at https://hexdocs.pm/shamir.

Development

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell