Skip to content
Snippets Groups Projects
Commit fb1c340a authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

formatting

parent 240c3fe5
No related branches found
No related tags found
1 merge request!52Validate the crypttext hash tree and the segments
......@@ -87,22 +87,22 @@ type Crypttext = BS.ByteString
-- | Structured representation of a single CHK share.
data Share = Share
{ _blockSize :: Word64
-- ^ The ZFEC block size. Legacy value. Unused.
, _dataSize :: Word64
-- ^ The share data length. Legacy value. Unused.
, _blocks :: [LBS.ByteString]
-- ^ The ZFEC encoded ciphertext blocks.
, _plaintextHashTree :: MerkleTree BS.ByteString SHA256d
-- ^ A merkle tree of plaintext segment hashes. Unimplemented.
, _crypttextHashTree :: MerkleTree Crypttext SHA256d
-- ^ A merkle tree of ciphertext segment hashes.
, _blockHashTree :: MerkleTree BS.ByteString SHA256d
-- ^ A merkle tree of hashes of `shareBlocks`.
, _neededHashes :: [(ShareNum, Digest' SHA256d)]
-- ^ The information needed to complete a merkle proof for this share.
, _uriExtension :: URIExtension
-- ^ Additional metadata about this share.
{ -- | The ZFEC block size. Legacy value. Unused.
_blockSize :: Word64
, -- | The share data length. Legacy value. Unused.
_dataSize :: Word64
, -- | The ZFEC encoded ciphertext blocks.
_blocks :: [LBS.ByteString]
, -- | A merkle tree of plaintext segment hashes. Unimplemented.
_plaintextHashTree :: MerkleTree BS.ByteString SHA256d
, -- | A merkle tree of ciphertext segment hashes.
_crypttextHashTree :: MerkleTree Crypttext SHA256d
, -- | A merkle tree of hashes of `shareBlocks`.
_blockHashTree :: MerkleTree BS.ByteString SHA256d
, -- | The information needed to complete a merkle proof for this share.
_neededHashes :: [(ShareNum, Digest' SHA256d)]
, -- | Additional metadata about this share.
_uriExtension :: URIExtension
}
deriving (Eq, Ord, Show, Generic, ToExpr)
......@@ -133,8 +133,7 @@ instance Binary Share where
-- much of allmydata.immutable.layout.
put
Share{..} =
let
-- shareDataSize is supposedly unused. Avoid making any
let -- shareDataSize is supposedly unused. Avoid making any
-- calculations based on its value. We'll serialize it into
-- the output but otherwise we should ignore it. Instead,
-- we'll use this computed value that's consistent with the
......@@ -198,8 +197,7 @@ instance Binary Share where
, LBS.fromStrict $ serializeNeededShares _neededHashes
, LBS.fromStrict $ encodeWord (intToWord64 $ BS.length ueb) <> ueb
]
in
do
in do
put (fromIntegral version :: Word32)
mapM_ putWord header
mapM_ putLazyByteString _blocks
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment