eric7/Documentation/Source/eric7.Utilities.crypto.py3PBKDF2.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Utilities.crypto.py3PBKDF2</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Utilities.crypto.py3PBKDF2</h1>
24
25 <p>
26 Module implementing PBKDF2 functions.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>Delimiter</td></tr><tr><td>Hashes</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36 <tr><td>None</td></tr>
37 </table>
38 <h3>Functions</h3>
39
40 <table>
41
42 <tr>
43 <td><a href="#hashPassword">hashPassword</a></td>
44 <td>Module function to hash a password according to the PBKDF2 specification.</td>
45 </tr>
46 <tr>
47 <td><a href="#hashPasswordTuple">hashPasswordTuple</a></td>
48 <td>Module function to hash a password according to the PBKDF2 specification.</td>
49 </tr>
50 <tr>
51 <td><a href="#pbkdf2">pbkdf2</a></td>
52 <td>Module function to hash a password according to the PBKDF2 specification.</td>
53 </tr>
54 <tr>
55 <td><a href="#rehashPassword">rehashPassword</a></td>
56 <td>Module function to recreate a password hash given the hash parameters.</td>
57 </tr>
58 <tr>
59 <td><a href="#verifyPassword">verifyPassword</a></td>
60 <td>Module function to verify a password against a hash encoded password.</td>
61 </tr>
62 </table>
63 <hr />
64 <hr />
65 <a NAME="hashPassword" ID="hashPassword"></a>
66 <h2>hashPassword</h2>
67 <b>hashPassword</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>)
68
69 <p>
70 Module function to hash a password according to the PBKDF2 specification.
71 </p>
72 <dl>
73
74 <dt><i>password</i></dt>
75 <dd>
76 clear text password (string)
77 </dd>
78 <dt><i>digestMod</i></dt>
79 <dd>
80 hash function
81 </dd>
82 <dt><i>iterations</i></dt>
83 <dd>
84 number of times hash function should be applied (integer)
85 </dd>
86 <dt><i>saltSize</i></dt>
87 <dd>
88 size of the salt (integer)
89 </dd>
90 </dl>
91 <dl>
92 <dt>Return:</dt>
93 <dd>
94 hashed password entry according to PBKDF2 specification (string)
95 </dd>
96 </dl>
97 <div align="right"><a href="#top">Up</a></div>
98 <hr />
99 <hr />
100 <a NAME="hashPasswordTuple" ID="hashPasswordTuple"></a>
101 <h2>hashPasswordTuple</h2>
102 <b>hashPasswordTuple</b>(<i>password, digestMod=hashlib.sha512, iterations=10000, saltSize=32</i>)
103
104 <p>
105 Module function to hash a password according to the PBKDF2 specification.
106 </p>
107 <dl>
108
109 <dt><i>password</i></dt>
110 <dd>
111 clear text password (string)
112 </dd>
113 <dt><i>digestMod</i></dt>
114 <dd>
115 hash function
116 </dd>
117 <dt><i>iterations</i></dt>
118 <dd>
119 number of times hash function should be applied (integer)
120 </dd>
121 <dt><i>saltSize</i></dt>
122 <dd>
123 size of the salt (integer)
124 </dd>
125 </dl>
126 <dl>
127 <dt>Return:</dt>
128 <dd>
129 tuple of digestname (string), number of iterations (integer),
130 salt (bytes) and hashed password (bytes)
131 </dd>
132 </dl>
133 <div align="right"><a href="#top">Up</a></div>
134 <hr />
135 <hr />
136 <a NAME="pbkdf2" ID="pbkdf2"></a>
137 <h2>pbkdf2</h2>
138 <b>pbkdf2</b>(<i>password, salt, iterations, digestMod</i>)
139
140 <p>
141 Module function to hash a password according to the PBKDF2 specification.
142 </p>
143 <dl>
144
145 <dt><i>password</i></dt>
146 <dd>
147 clear text password (bytes)
148 </dd>
149 <dt><i>salt</i></dt>
150 <dd>
151 salt value (bytes)
152 </dd>
153 <dt><i>iterations</i></dt>
154 <dd>
155 number of times hash function should be applied (integer)
156 </dd>
157 <dt><i>digestMod</i></dt>
158 <dd>
159 hash function
160 </dd>
161 </dl>
162 <dl>
163 <dt>Return:</dt>
164 <dd>
165 hashed password (bytes)
166 </dd>
167 </dl>
168 <div align="right"><a href="#top">Up</a></div>
169 <hr />
170 <hr />
171 <a NAME="rehashPassword" ID="rehashPassword"></a>
172 <h2>rehashPassword</h2>
173 <b>rehashPassword</b>(<i>password, hashParameters</i>)
174
175 <p>
176 Module function to recreate a password hash given the hash parameters.
177 </p>
178 <dl>
179
180 <dt><i>password</i></dt>
181 <dd>
182 clear text password (string)
183 </dd>
184 <dt><i>hashParameters</i></dt>
185 <dd>
186 hash parameters in the form
187 'digestmod$iterations$salt' (string)
188 </dd>
189 </dl>
190 <dl>
191 <dt>Return:</dt>
192 <dd>
193 hashed password (bytes)
194 </dd>
195 </dl>
196 <dl>
197
198 <dt>Raises <b>ValueError</b>:</dt>
199 <dd>
200 the hash parameters string is not of the expected
201 format or the digest is not one of the known ones
202 </dd>
203 </dl>
204 <div align="right"><a href="#top">Up</a></div>
205 <hr />
206 <hr />
207 <a NAME="verifyPassword" ID="verifyPassword"></a>
208 <h2>verifyPassword</h2>
209 <b>verifyPassword</b>(<i>password, pwHash</i>)
210
211 <p>
212 Module function to verify a password against a hash encoded password.
213 </p>
214 <dl>
215
216 <dt><i>password</i></dt>
217 <dd>
218 clear text password (string)
219 </dd>
220 <dt><i>pwHash</i></dt>
221 <dd>
222 hash encoded password in the form
223 'digestmod$iterations$salt$hashed_password' as produced by the
224 hashPassword function (string)
225 </dd>
226 </dl>
227 <dl>
228 <dt>Return:</dt>
229 <dd>
230 flag indicating a successfull verification (boolean)
231 </dd>
232 </dl>
233 <dl>
234
235 <dt>Raises <b>ValueError</b>:</dt>
236 <dd>
237 the hash is not of the expected format or the
238 digest is not one of the known ones
239 </dd>
240 </dl>
241 <div align="right"><a href="#top">Up</a></div>
242 <hr />
243 </body></html>

eric ide

mercurial