Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- zfec :: Int -> Int -> ByteString -> IO [ByteString]
- zunfec :: Int -> Int -> [(Int, ByteString)] -> IO ByteString
- encode :: AESKey128 -> Parameters -> ByteString -> IO ([Share], Reader)
- decode :: Reader -> [(Int, Share)] -> IO (Maybe ByteString)
- padCiphertext :: Required -> ByteString -> ByteString
- segmentCiphertext :: Parameters -> ByteString -> [ByteString]
Documentation
:: Int | The number of outputs that will be required to reverse the encoding.
Also known as |
-> Int | The total number of outputs to produce. Also known as |
-> ByteString | Application data to divide into encoding inputs. |
-> IO [ByteString] |
|
Erasure encode some bytes using ZFEC.
:: Int | The |
-> Int | The |
-> [(Int, ByteString)] | The encoding outputs annotated with their position (or "share number"). |
-> IO ByteString | The bytes which were originally encoded. |
Erasure decode some bytes using ZFEC.
:: AESKey128 | The encryption/decryption key. |
-> Parameters | The ZFEC parameters for this encoding. This determines how many shares will come out of this function. |
-> ByteString | The data to encode. This is typically ciphertext. |
-> IO ([Share], Reader) | An IO which can be evaluated to get the encoded share data and the
read capability. The number of Shares will equal the |
Encode some application data (typically ciphertext, but this function only weakly assumes this is the case) into some CHK shares.
This replaces much of allmydata.immutable.encode.
:: Reader | The read capability for the application data. |
-> [(Int, Share)] | At least as many shares as are required to erasure decode the ciphertext. |
-> IO (Maybe ByteString) | An action that results in the ciphertext contained by the shares if it is possible to recover it, or Nothing. |
Decode some CHK shares to recover some application data. This is roughly
the inverse of `encode`
.
padCiphertext :: Required -> ByteString -> ByteString Source #
:: Parameters | The encoding parameters which determine how to split the ciphertext. |
-> ByteString | The ciphertext. |
-> [ByteString] | The segments. |
Split a full ciphertext string into the separate ciphertext segments required by most of CHK encoding.