Handbook
Glossary
checksum-lines ( lines checksum -- value )
Factor handbook
»
Input and output
»
Checksums
Prev:
checksum-stream ( stream checksum -- value )
Next:
checksum-file ( path checksum -- value )
Vocabulary
checksums
Inputs
lines
a sequence of sequences of bytes
checksum
a checksum specifier
Outputs
value
a
byte-array
Generic word contract
Computes the checksum of all data in a sequence.
Examples
USING: checksums checksums.crc32 prettyprint ; { "Take me out to the ball game" "Take me out with the crowd" } crc32 checksum-lines .
B{ 111 205 9 27 }
Definition
IN:
checksums
GENERIC:
checksum-lines
( lines checksum -- value )
Methods
USING:
checksums
kernel
sequences
;
M:
checksum
checksum-lines
[
B{
10
}
join
]
dip
checksum-bytes
;
USING:
checksums
checksums.crc16
sequences
;
M:
crc16
checksum-lines
init-crc16
[
[
(crc16)
]
each
10
(crc16)
]
each
finish-crc16
;
inline
USING:
checksums
checksums.crc32
sequences
;
M:
crc32
checksum-lines
init-crc32
[
[
(crc32)
]
each
10
(crc32)
]
each
finish-crc32
;
inline