block-checksum-state


Vocabulary
checksums.common

Definition


Methods

M:: block-checksum-state add-checksum-bytes
( state data -- checksum-state )
state block-size>> :> block-size state bytes>> length
:> initial-len initial-len data length +
block-size /mod :> ( n extra ) data state bytes>>
[ push-all ] keep :> all-bytes all-bytes block-size <groups>
extra zero? [ f ] [ unclip-last-slice ] if
:> ( blocks remain ) state
[ initial-len - ] change-bytes-read drop blocks
[ state [ block-size + ] change-bytes-read checksum-block ]
each state [ extra + ] change-bytes-read remain
[ >byte-vector ] [ BV{ } clone ] if* >>bytes ;