]> gitweb.factorcode.org Git - factor.git/blob - basis/checksums/openssl/openssl-docs.factor
Create basis vocab root
[factor.git] / basis / checksums / openssl / openssl-docs.factor
1 IN: checksums.openssl
2 USING: help.syntax help.markup ;
3
4 HELP: openssl-checksum
5 { $class-description "The class of checksum algorithms implemented by OpenSSL. The exact set of algorithms supported depends on how the OpenSSL library was compiled; " { $snippet "md5" } " and " { $snippet "sha1" } " should be universally available." } ;
6
7 HELP: <openssl-checksum> ( name -- checksum )
8 { $values { "name" "an EVP message digest name" } { "checksum" openssl-checksum } }
9 { $description "Creates a new OpenSSL checksum object." } ;
10
11 HELP: openssl-md5
12 { $description "The OpenSSL MD5 message digest implementation." } ;
13
14 HELP: openssl-sha1
15 { $description "The OpenSSL SHA1 message digest implementation." } ;
16
17 HELP: unknown-digest
18 { $error-description "Thrown by checksum words if they are passed an " { $link openssl-checksum } " naming a message digest not supported by OpenSSL." } ;
19
20 ARTICLE: "checksums.openssl" "OpenSSL checksums"
21 "The OpenSSL library provides a large number of efficient checksum (message digest) algorithms which may be used independently of its SSL functionality."
22 { $subsection openssl-checksum }
23 "Constructing a checksum from a known name:"
24 { $subsection <openssl-checksum> }
25 "Two utility words:"
26 { $subsection openssl-md5 }
27 { $subsection openssl-sha1 }
28 "An error thrown if the digest name is unrecognized:"
29 { $subsection unknown-digest }
30 "An example where we compute the SHA1 checksum of a string using the OpenSSL implementation of SHA1:"
31 { $example "USING: byte-arrays checksums checksums.openssl prettyprint ;" "\"hello world\" >byte-array openssl-sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" }
32 "If we use the Factor implementation, we get the same result, just slightly slower:"
33 { $example "USING: byte-arrays checksums checksums.sha1 prettyprint ;" "\"hello world\" >byte-array sha1 checksum-bytes hex-string ." "\"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed\"" } ;
34
35 ABOUT: "checksums.openssl"