Checksums
Factor documentation > Factor handbook > Input and output
Prev:Formatted output
Next:ANSI C streams


A checksum is a function mapping sequences of bytes to fixed-length strings. While checksums are not one-to-one, a good checksum should have a low probability of collision. Additionally, some checksum algorithms are designed to be hard to reverse, in the sense that finding an input string which hashes to a given checksum string requires a brute-force search.

Checksums are instances of a class:
checksum


Operations on checksums:
checksum-bytes ( bytes checksum -- value )

checksum-stream ( stream checksum -- value )

checksum-lines ( lines checksum -- value )


Checksums should implement at least one of checksum-bytes and checksum-stream. Implementing checksum-lines is optional.

Utilities:
checksum-file ( path checksum -- value )

hex-string ( seq -- str )


Checksum implementations:
CRC32 checksum

MD5 checksum
SHA-2 checksum
Adler-32 checksum
OpenSSL checksums
Internet checksum