Skip to content
Snippets Groups Projects
Commit f7d92706 authored by Update Bot's avatar Update Bot
Browse files

Trivially simplify ShareBlock handling by using 1-indexed counting

parent 17221714
Branches
Tags
No related merge requests found
......@@ -335,11 +335,11 @@ chkEncode version stateRef p@(Parameters segmentSize total happy required) dataS
setStage URIExtensionOffset
same_blocks . toStrictByteString . intBE $ startOfData + shareSize + 3 * segmentHashSize
URIExtensionOffset -> do
setStage (ShareBlock 0)
setStage (ShareBlock 1)
same_blocks . toStrictByteString . intBE $ startOfData + shareSize + 3 * segmentHashSize + shareHashTreeSize
ShareBlock segmentNumber -> do
setStage $
if segmentNumber + 1 == numSegments
if segmentNumber == numSegments
-- After reading this segment, we will have reached the expected (and
-- published) share size. Proceed.
then PlaintextHashTree
......@@ -348,7 +348,7 @@ chkEncode version stateRef p@(Parameters segmentSize total happy required) dataS
else ShareBlock (segmentNumber + 1)
let paddedCiphertext crypttext =
if segmentNumber + 1 == numSegments
if segmentNumber == numSegments
-- Allow the last ciphertext segment to be short. Pad it with
-- nulls if necessary.
then padTailSegment crypttext
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment