Handbook
Glossary
add-checksum-bytes ( checksum-state data -- checksum-state )
Factor handbook
»
Input and output
»
Checksums
Prev:
initialize-checksum-state ( checksum -- checksum-state )
Next:
add-checksum-stream ( checksum-state stream -- checksum-state )
Vocabulary
checksums
Inputs
checksum-state
an
object
data
an
object
Outputs
checksum-state
an
object
Definition
IN:
checksums
GENERIC#:
add-checksum-bytes
1
( checksum-state data -- checksum-state )
Methods
USING:
accessors
checksums
checksums.common
grouping
kernel
math
math.order
sequences
;
M::
block-checksum-state
add-checksum-bytes
( state data -- checksum-state )
state
bytes>>
:>
bytes state
block-size>>
:>
block-size
bytes
[
data
]
[
length
:>
initial-len block-size initial-len
-
:>
needed needed 0
>
t
assert=
data
dup
length
needed
min
cut-slice
[
state
over
length
[
+
]
curry
change-bytes-read
drop
bytes
push-all
bytes
length
block-size
=
[
bytes state
checksum-block
bytes
delete-all
]
when
]
dip
]
if-empty
dup
length
block-size
mod
cut-slice*
[
block-size
<groups>
[
bytes
push-all
bytes state
[
block-size
+
]
change-bytes-read
checksum-block
bytes
delete-all
]
each
]
[
[
bytes
push-all
]
[
state
swap
length
[
+
]
curry
change-bytes-read
]
bi
]
bi*
;
USING:
accessors
checksums
kernel
sequences
;
M:
checksum-state
add-checksum-bytes
over
bytes>>
push-all
;
USING:
accessors
checksums
checksums.openssl.private
kernel
openssl
openssl.libcrypto
sequences
;
M:
evp-md-context
add-checksum-bytes
[
dup
handle>>
]
dip
dup
length
EVP_DigestUpdate
ssl-error
;
USING:
accessors
checksums
checksums.multi
kernel
sequences
;
M:
multi-state
add-checksum-bytes
[
add-checksum-bytes
]
curry
[
map!
]
curry
change-states
;
USING:
accessors
checksums
checksums.process
io
kernel
;
M:
process-state
add-checksum-bytes
over
process>>
stream-write
;