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"
This documentation was generated offline from a
load-all
image. If you want, you can also
browse the documentation from within the UI developer tools . See
the Factor website
for more information.
Factor 0.101 x86.64 (2287, heads/master-f4b0c147f7, Dec 15 2024 19:35:07)