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
- type Crypttext = ByteString
- data Share = Share {}
- uriExtension :: Lens' Share URIExtension
- plaintextHashTree :: Lens' Share (MerkleTree ByteString SHA256d)
- neededHashes :: Lens' Share [(ShareNum, Digest' SHA256d)]
- dataSize :: Lens' Share Word64
- crypttextHashTree :: Lens' Share (MerkleTree Crypttext SHA256d)
- blocks :: Lens' Share [ByteString]
- blockSize :: Lens' Share Word64
- blockHashTree :: Lens' Share (MerkleTree ByteString SHA256d)
- 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 :: HashAlgorithm hash => [(ShareNum, Digest' hash)] -> ByteString
- unserializeNeededShares :: forall hash. HashAlgorithm hash => ByteString -> Maybe [(ShareNum, Digest' hash)]
- 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
type Crypttext = ByteString Source #
A byte string of encrypted data.
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 :: HashAlgorithm hash => [(ShareNum, Digest' hash)] -> ByteString Source #
Serialize the list of (share number, block tree root hash) pairs for inclusion in the serialized form of a Share. The inverse of unserializeNeededShares.
unserializeNeededShares :: forall hash. HashAlgorithm hash => ByteString -> Maybe [(ShareNum, Digest' hash)] Source #
Unserialize a a list of (share number, block tree root hash) pairs from their form in a serialized Share. The inverse of serializeNeededShares.
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 |