((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/pbkdf2" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "PBKDF2" (toc) (section 3 "Description" (p "Password-Based Key Derivation Function as defined in " (link "https://tools.ietf.org/html/rfc2898#section-5.2" "RFC2898")) (p "Note that PBKDF2 is recommended for new applications while PBKDF1 is recommended only for backwards compatibility with existing applications since the keys it produces may not be large enough for some applications.")) (section 3 "Author" (p "Tobias Heilig") (p "<0x70b1 at web . de>")) (section 3 "Repository" (p (link "https://github.com/off-world/pbkdf2"))) (section 3 "Requirements" (ul (li (int-link "/eggref/4/message-digest" "message-digest")) (li (int-link "/eggref/4/hmac" "hmac")) (li (int-link "/eggref/4/sha1" "sha2")) (li (int-link "/eggref/4/sha2" "sha1")) (li (int-link "/eggref/4/md5" "md5")) (li (int-link "/eggref/4/md2" "md2")))) (section 3 "API" (section 4 "Common Argument Definitions" (section 5 "password" (p "password as a string")) (section 5 "salt" (p "salt as a string")) (section 5 "count" (p "iteration count as a positive exact integer")) (section 5 "dklen" (p "length in bytes of the derived key as a positive exact integer")) (section 5 "result-type" (dl (dt (tt "'blob")) (dd "return resulting bytes as a blob") (dt (tt "'hex")) (dd "return resulting bytes as a string of lower-case hexadecimal digits") (dt (tt "'string")) (dd "return resulting bytes as a byte-string") (dt (tt "'u8vector")) (dd "return resulting bytes as a u8vector")))) (section 4 "Procedures" (section 5 (tt "pbkdf1-md2") (def (sig (procedure "(pbkdf1-md2 password salt count dklen #!optional (result-type 'blob))" (id pbkdf1-md2))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF1 with MD2. The maximum length of the derived key is bounded by the length of the hash function output which is 16 bytes for MD2."))) (section 5 (tt "pbkdf1-md5") (def (sig (procedure "(pbkdf1-md5 password salt count dklen #!optional (result-type 'blob))" (id pbkdf1-md5))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF1 with MD5. The maximum length of the derived key is bounded by the length of the hash function output which is 16 bytes for MD5."))) (section 5 (tt "pbkdf1-sha1") (def (sig (procedure "(pbkdf1-sha1 password salt count dklen #!optional (result-type 'blob))" (id pbkdf1-sha1))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF1 with SHA1. The maximum length of the derived key is bounded by the length of the hash function output which is 20 bytes for SHA1."))) (section 5 (tt "pbkdf2-hmac-sha1") (def (sig (procedure "(pbkdf2-hmac-sha1 password salt count dklen #!optional (result-type 'blob))" (id pbkdf2-hmac-sha1))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF2 with HMAC-SHA1. The maximum length of the derived key is 2^32 - 1."))) (section 5 (tt "pbkdf2-hmac-sha256") (def (sig (procedure "(pbkdf2-hmac-sha256 password salt count dklen #!optional (result-type 'blob))" (id pbkdf2-hmac-sha256))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF2 with HMAC-SHA256. The maximum length of the derived key is 2^32 - 1."))) (section 5 (tt "pbkdf2-hmac-sha384") (def (sig (procedure "(pbkdf2-hmac-sha384 password salt count dklen #!optional (result-type 'blob))" (id pbkdf2-hmac-sha384))) (p "Derives a key of " (tt "dklen") " bytes from the given " (tt "password") " and " (tt "salt") " using PBKDF2 with HMAC-SHA384. The maximum length of the derived key is 2^32 - 1."))) (section 5 (tt "pbkdf2-hmac-sha512") (def (sig (procedure "(pbkdf2-hmac-sha512 password salt count dklen #!optional (result-type 'blob))" (id pbkdf2-hmac-sha512))) (p "Derives a key of " (int-link "dklen") " bytes from the given " (int-link "password") " and " (int-link "salt") " using PBKDF2 with HMAC-SHA512. The maximum length of the derived key is 2^32 - 1."))))) (section 3 "Examples" (highlight scheme "(use pbkdf2)\n \n(pbkdf2-hmac-sha1 \"password\" \"salt\" 4096 20)\n;=> #${4b007901b765489abead49d926f721d065a429c1}\n\n(pbkdf2-hmac-sha1 \"password\" \"salt\" 4096 20 'hex)\n;=> \"4b007901b765489abead49d926f721d065a429c1\"")) (section 3 "License" (pre "Copyright (c) 2018, Tobias Heilig\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n3. The name of the authors may not be used to endorse or promote products\n   derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\nGOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER\nIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\nOTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\nIF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")) (section 3 "Version History" (dl (dt "1.2") (dd "added MD2 support for PBKDF1") (dt "1.1") (dd "added PBKDF1 implementation") (dt "1.0") (dd "initial release")))))