checksums: Really fix... only add the number of extra bytes in the last unchecksummed block.
parent
2c5a2e9600
commit
d6d4e0e903
|
@ -50,7 +50,7 @@ GENERIC: get-checksum ( checksum-state -- value )
|
|||
] while
|
||||
>byte-vector >>bytes
|
||||
] keep
|
||||
length [ + ] curry change-bytes-read ;
|
||||
length 64 mod [ + ] curry change-bytes-read ;
|
||||
|
||||
: add-checksum-stream ( checksum-state stream -- checksum-state )
|
||||
[ [ add-checksum-bytes ] each-block ] with-input-stream ;
|
||||
|
|
|
@ -73,5 +73,5 @@ CONSTANT: bytes-a B{ 0 1 0 0 0 0 0 0 }
|
|||
CONSTANT: bytes-b B{ 1 2 3 4 5 6 7 8 }
|
||||
{ t } [
|
||||
sha1 initialize-checksum-state bytes-a bytes-b append add-checksum-bytes get-checksum
|
||||
sha1 initialize-checksum-state bytes-a add-checksum-bytes bytes-b add-checksum-bytes get-checksum
|
||||
sha1 initialize-checksum-state bytes-a add-checksum-bytes bytes-b add-checksum-bytes get-checksum =
|
||||
] unit-test
|
||||
|
|
Loading…
Reference in New Issue