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.Internal

Description

 

Synopsis

Documentation

data Fragment Source

A fragment of the original data.

Constructors

Fragment 

Fields

fragmentId :: !Int

index of this fragment

trailLength :: !Int

number of symbols added to the original message

reconstructionThreshold :: !Int

number of fragments required for reconstruction

theContent :: ![FField]

the encoded content of the fragment

msgLength :: !Int

length of the original message

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.

toIntVec :: Int -> ByteString -> (Vector FField, Int) Source

Takes an integer m and a bytestring and converts the bytestring into a 'Vector Word8', appending 0s at the end such that the length is dividable by m.

fromIntVec :: Int -> Vector FField -> ByteString Source

Converts a bytestring to a 'Vector Word8', removing the trailing 0s.

groupInto :: Int -> Vector a -> [Vector a] Source

Splits a vector into lists of the given size. O(vector-length / size).