OpenSSL checksums


The OpenSSL library provides a large number of efficient checksum (message digest) algorithms which may be used independently of its SSL functionality.
openssl-checksum


Constructing a checksum from a known name:
<openssl-checksum> ( name -- openssl-checksum )


Two utility words:
openssl-md5 ( -- value )

openssl-sha1 ( -- value )


An error thrown if the digest name is unrecognized:
unknown-digest ( name -- * )


An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:
USING: byte-arrays checksums checksums.openssl hex-strings ; "hello world" >byte-array openssl-sha1 checksum-bytes bytes>hex-string .
"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"

If we use the Factor implementation, we get the same result, just slightly slower:
USING: byte-arrays checksums checksums.sha hex-strings ; "hello world" >byte-array sha1 checksum-bytes bytes>hex-string .
"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed"