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

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

eric ide

mercurial