Splitting a secret #
Each secret byte s gets its own polynomial f(x) = s + r₁·x + … + r_{k−1}·x^{k−1}, where
r₁ … r_{k−1} are random. Share i (for i = 1 … n) is the point x = i together with the
values of all those polynomials at x.
split is pure: the random coefficients are an argument. Only the CLI reads the OS
random number generator. Theorems can therefore talk about every possible choice of randomness.
The share indices 1, 2, …, n as field elements.
Equations
- QedShare.Shamir.indices n = List.map (fun (i : Nat) => { val := (i + 1).toUInt8 }) (List.range n)
Instances For
Randomness of the right shape for p and a secret of length len: one list of k − 1
coefficients per secret byte.
Equations
- QedShare.Shamir.ValidRand p len rand = (rand.length = len ∧ ∀ (r : QedShare.Poly), r ∈ rand → List.length r = p.k - 1)
Instances For
Deciding ValidRand with List.all, which runs as a loop. (The generic instance for
∀ r ∈ rand, … recurses once per secret byte and can overflow the stack on large secrets.)
Equations
- QedShare.Shamir.instDecidableValidRand p len rand = decidable_of_iff (rand.length = len ∧ (rand.all fun (x : QedShare.Poly) => List.length x == p.k - 1) = true) ⋯
The share at index x: the value at x of every byte's polynomial s :: r.
Equations
- QedShare.Shamir.shareAt secret rand x = { x := x, ys := List.zipWith (fun (s : QedShare.GF256) (r : List QedShare.GF256) => QedShare.Poly.eval (s :: r) x) secret rand }
Instances For
Why split refused to run.
- badRandomness : SplitError
The randomness does not have one list of
k − 1coefficients per secret byte.
Instances For
Equations
- One or more equations did not get rendered due to their size.