Copyright | Peter Robinson 2014 |
---|---|
License | LGPL |
Maintainer | Peter Robinson <peter.robinson@monoid.at> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
- data ByteShare = ByteShare {
- shareId :: !Int
- reconstructionThreshold :: !Int
- shareValue :: !Int
- data Share = Share {}
- encode :: Int -> Int -> ByteString -> IO [Share]
- decode :: [Share] -> ByteString
- encodeByte :: Int -> Int -> Polyn -> FField -> Vector ByteShare
- decodeByte :: [ByteShare] -> FField
- groupInto :: Int -> [a] -> [[a]]
- newtype FField = FField {}
- prime :: Int
- type Polyn = [FField]
- evalPolynomial :: Polyn -> FField -> FField
Documentation
A share of an encoded byte.
ByteShare | |
|
:: Int | m |
-> Int | n |
-> ByteString | the secret that we want to share |
-> IO [Share] |
Encodes a ByteString
as a list of n shares, m of which are required for
reconstruction.
Lives in the IO
to access a random source.
:: [Share] | list of at least |
-> ByteString | reconstructed secret |
Reconstructs a (secret) bytestring from a list of (at least m
) shares.
Throws AssertionFailed
if the number of shares is too small.
decodeByte :: [ByteShare] -> FField Source
groupInto :: Int -> [a] -> [[a]] Source
Groups a list into blocks of certain size. Running time: O(n)
A finite prime field. All computations are performed in this field.
evalPolynomial :: Polyn -> FField -> FField Source
Evaluates the polynomial at a given point.