Copyright | Peter Robinson 2014 |
---|---|
License | LGPL |
Maintainer | Peter Robinson <peter.robinson@monoid.at> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module provides an implementation of a space efficient (m,n)-threshold information dispersal algorithm (IDA) as described in "Efficient Dispersal of Information for Security, Load Balancing, and Fault Tolerance", by Michael O. Rabin, JACM 1989.
Given a ByteString bstr of length D
>>> f = encode m n bstr
encodes bstr as a list of n Fragment
s, each containing a ByteString
of length approximately D/m
. For reconstructing the original ByteString out
of a sublist fssub of fs,
consisting of at least m fragments, use
>>> decode fssub
- encode :: Int -> Int -> ByteString -> [Fragment]
- decode :: [Fragment] -> ByteString
- data Fragment
Documentation
:: Int | m: we need ≥ |
-> Int | n: total number of fragments into which we are going to
split the message; |
-> ByteString | the original message |
-> [Fragment] |
|
Takes a message (a bytestring) and yields n
fragments such that any m
of
them are sufficient for reconstructing the original message.
decode :: [Fragment] -> ByteString Source
Takes a list of at least m fragments (where m
is the reconstruction
threshold used for encode
) and tries to reconstruct the original message.
Throws an AssertionFailed
exception if there are less than m fragments
or if the fragments belong to a different message.