
Built a Shamir Secret Sharing implementation in Rust (splits encryption keys across shards)
I've been working on a Rust implementation of Shamir's Secret Sharing for the past few days. Take a 32-byte encryption key, split it into N shards using polynomial math over a prime field, and require any T of those shards to reconstruct it.
The repo has the full flow: encrypt a file, split the key into shards, then reconstruct and decrypt using only a threshold of them. Uses num-bigint for the field arithmetic and aes-gcm for AEAD encryption.
repo: https://github.com/owlpharoah/shamirsecret
I built this mostly to understand the math properly. The polynomial evaluation and reconstruction logic was trickier than I expected, especially getting the modular inverses right.
Theres still some edge cases and error handling for me to fix and some bugs (with the random coeff sampling) i need to squash.