data-dispersal-1.0.0.2: Space-efficient and privacy-preserving data dispersal algorithms.

CopyrightPeter Robinson 2014
LicenseLGPL
MaintainerPeter Robinson <peter.robinson@monoid.at>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Data.IDA

Description

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 Fragments, 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

Synopsis

Documentation

encode Source

Arguments

:: Int

m: we need ≥ m fragments to reconstruct the original message

-> Int

n: total number of fragments into which we are going to split the message; nm

-> ByteString

the original message

-> [Fragment]

n fragments

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.

data Fragment Source

A fragment of the original data.