source: project/wiki/eggref/4/pbkdf2 @ 36647

Last change on this file since 36647 was 36647, checked in by off_world, 3 months ago
File size: 3.1 KB
Line 
1== PBKDF2
2
3[[toc:]]
4
5=== Description
6
7Password-Based Key Derivation Function 2 as defined in [[https://tools.ietf.org/html/rfc2898#section-5.2|RFC2898]]
8
9=== Author
10
11Tobias Heilig <off_world at gmx . de>
12
13=== Repository
14
15[[https://github.com/off-world/pbkdf2]]
16
17=== Requirements
18
19* [[http://api.call-cc.org/doc/hmac|hmac]]
20* [[http://api.call-cc.org/doc/sha1|sha1]]
21* [[http://api.call-cc.org/doc/sha2|sha2]]
22
23=== API
24
25==== Common Argument Definitions
26
27===== result-type
28; {{'string}} : return resulting bytes as a byte-string
29; {{'hex}} : return resulting bytes as a string of lower-case hexadecimal digits
30; {{'blob}} : return resulting bytes as a blob
31; {{'u8vector}} : return resulting bytes as a u8vector
32
33===== password
34password as a string
35
36===== salt
37salt as a string
38
39===== count
40iteration count as a positive exact integer
41
42===== dklen
43length in bytes of the derived key as a positive exact integer
44
45==== Procedures
46
47===== pbkdf2-hmac-sha1
48<procedure>(pbkdf2-hmac-sha1 password salt count dklen #!optional (result-type 'blob)</procedure>
49
50===== pbkdf2-hmac-sha256
51<procedure>(pbkdf2-hmac-sha256 password salt count dklen #!optional (result-type 'blob)</procedure>
52
53===== pbkdf2-hmac-sha384
54<procedure>(pbkdf2-hmac-sha384 password salt count dklen #!optional (result-type 'blob)</procedure>
55
56===== pbkdf2-hmac-sha512
57<procedure>(pbkdf2-hmac-sha512 password salt count dklen #!optional (result-type 'blob)</procedure>
58
59=== Examples
60
61<enscript highlight=scheme>
62(use pbkdf2)
63 
64(pbkdf2-hmac-sha1 "password" "salt" 4096 20)
65;=> #${4b007901b765489abead49d926f721d065a429c1}
66
67(pbkdf2-hmac-sha1 "password" "salt" 4096 20 'hex)
68;=> "4b007901b765489abead49d926f721d065a429c1"
69</enscript>
70
71=== License
72
73 Copyright (c) 2018, Tobias Heilig
74 All rights reserved.
75 
76 Redistribution and use in source and binary forms, with or without
77 modification, are permitted provided that the following conditions
78 are met:
79 
80 1. Redistributions of source code must retain the above copyright
81    notice, this list of conditions and the following disclaimer.
82 2. Redistributions in binary form must reproduce the above copyright
83    notice, this list of conditions and the following disclaimer in the
84    documentation and/or other materials provided with the distribution.
85 3. The name of the authors may not be used to endorse or promote products
86    derived from this software without specific prior written permission.
87 
88 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
89 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
90 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
91 ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
92 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
93 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
94 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
96 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
97 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
98 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
99
100=== Version History
101; 1.0 : initial release
Note: See TracBrowser for help on using the repository browser.