Safe Haskell | None |
---|---|
Language | Haskell2010 |
A share is a single data object comprising some erasure-encoded data and some cryptographic hashes which allow certain determinations to be made about that that data. One or more shares can be interpreted together, typically to recover a particular ciphertext object.
This modules exposes a structured representation of the share object along with an encoder to and decoder from the canonical serialized representation.
Synopsis
- data Share = Share {}
- getWord32 :: Get Word64
- getWord64 :: Get Word64
- word64To4Bytes :: Word64 -> Maybe ByteString
- word64To4Bytes' :: Word64 -> Either String ByteString
- word64To8Bytes :: Word64 -> ByteString
- segmentLazyBytes :: Int64 -> ByteString -> [ByteString]
- isolateBetween :: String -> Word64 -> Word64 -> Get a -> Get a
- getLazyByteStringInBoundsFrom :: String -> Word64 -> Word64 -> Get ByteString
- getInt64FromWord64 :: String -> Word64 -> Get Int64
- word64ToInt64 :: Word64 -> Maybe Int64
- word64ToWord32 :: Word64 -> Maybe Word32
- maxWord32 :: Integral i => i
- serializeNeededShares :: [(ShareNum, ByteString)] -> ByteString
- unserializeNeededShares :: ByteString -> [(ShareNum, ByteString)]
- intToWord64 :: Int -> Word64
- int64ToWord64 :: Int64 -> Word64
- getVersion :: Get (Word8, Get Word64)
- chooseVersion :: Word64 -> (Word8, Word64 -> ByteString, Word64 -> Put)
- fieldSizeForVersion :: Word8 -> Int
- word64To4BytesPartial :: Word64 -> ByteString
- newtype EncodingError = Word64OutOfBounds Word64
Documentation
Structured representation of a single CHK share.
Share | |
|
Instances
word64To4Bytes :: Word64 -> Maybe ByteString Source #
word64To8Bytes :: Word64 -> ByteString Source #
segmentLazyBytes :: Int64 -> ByteString -> [ByteString] Source #
getLazyByteStringInBoundsFrom :: String -> Word64 -> Word64 -> Get ByteString Source #
serializeNeededShares :: [(ShareNum, ByteString)] -> ByteString Source #
unserializeNeededShares :: ByteString -> [(ShareNum, ByteString)] Source #
intToWord64 :: Int -> Word64 Source #
int64ToWord64 :: Int64 -> Word64 Source #
chooseVersion :: Word64 -> (Word8, Word64 -> ByteString, Word64 -> Put) Source #
fieldSizeForVersion :: Word8 -> Int Source #
word64To4BytesPartial :: Word64 -> ByteString Source #
Serialize a Word64 to 4 bytes or throw an exception if the value can not fit.
newtype EncodingError Source #
Instances
Eq EncodingError Source # | |
Defined in Tahoe.CHK.Share (==) :: EncodingError -> EncodingError -> Bool # (/=) :: EncodingError -> EncodingError -> Bool # | |
Ord EncodingError Source # | |
Defined in Tahoe.CHK.Share compare :: EncodingError -> EncodingError -> Ordering # (<) :: EncodingError -> EncodingError -> Bool # (<=) :: EncodingError -> EncodingError -> Bool # (>) :: EncodingError -> EncodingError -> Bool # (>=) :: EncodingError -> EncodingError -> Bool # max :: EncodingError -> EncodingError -> EncodingError # min :: EncodingError -> EncodingError -> EncodingError # | |
Show EncodingError Source # | |
Defined in Tahoe.CHK.Share showsPrec :: Int -> EncodingError -> ShowS # show :: EncodingError -> String # showList :: [EncodingError] -> ShowS # | |
Exception EncodingError Source # | |
Defined in Tahoe.CHK.Share |