75 <tr> |
75 <tr> |
76 <td><a href="#AES.__addRoundKey">__addRoundKey</a></td> |
76 <td><a href="#AES.__addRoundKey">__addRoundKey</a></td> |
77 <td>Private method to add (XORs) the round key to the state.</td> |
77 <td>Private method to add (XORs) the round key to the state.</td> |
78 </tr><tr> |
78 </tr><tr> |
79 <td><a href="#AES.__aes_invMain">__aes_invMain</a></td> |
79 <td><a href="#AES.__aes_invMain">__aes_invMain</a></td> |
80 <td>Private method to perform the initial operations, the standard round, and the final operations of the inverse AES, creating a round key for each round.</td> |
80 <td>Private method to do the inverse AES encryption for one round.</td> |
81 </tr><tr> |
81 </tr><tr> |
82 <td><a href="#AES.__aes_invRound">__aes_invRound</a></td> |
82 <td><a href="#AES.__aes_invRound">__aes_invRound</a></td> |
83 <td>Private method to apply the 4 operations of the inverse round in sequence.</td> |
83 <td>Private method to apply the 4 operations of the inverse round in sequence.</td> |
84 </tr><tr> |
84 </tr><tr> |
85 <td><a href="#AES.__aes_main">__aes_main</a></td> |
85 <td><a href="#AES.__aes_main">__aes_main</a></td> |
86 <td>Private method to perform the initial operations, the standard round, and the final operations of the forward AES, creating a round key for each round.</td> |
86 <td>Private method to do the AES encryption for one round.</td> |
87 </tr><tr> |
87 </tr><tr> |
88 <td><a href="#AES.__aes_round">__aes_round</a></td> |
88 <td><a href="#AES.__aes_round">__aes_round</a></td> |
89 <td>Private method to apply the 4 operations of the forward round in sequence.</td> |
89 <td>Private method to apply the 4 operations of the forward round in sequence.</td> |
90 </tr><tr> |
90 </tr><tr> |
91 <td><a href="#AES.__core">__core</a></td> |
91 <td><a href="#AES.__core">__core</a></td> |
158 </dd> |
158 </dd> |
159 </dl><a NAME="AES.__aes_invMain" ID="AES.__aes_invMain"></a> |
159 </dl><a NAME="AES.__aes_invMain" ID="AES.__aes_invMain"></a> |
160 <h4>AES.__aes_invMain</h4> |
160 <h4>AES.__aes_invMain</h4> |
161 <b>__aes_invMain</b>(<i>state, expandedKey, nbrRounds</i>) |
161 <b>__aes_invMain</b>(<i>state, expandedKey, nbrRounds</i>) |
162 <p> |
162 <p> |
163 Private method to perform the initial operations, the standard round, and the |
163 Private method to do the inverse AES encryption for one round. |
164 final operations of the inverse AES, creating a round key for each round. |
164 </p><p> |
|
165 Perform the initial operations, the standard round, and the |
|
166 final operations of the inverse AES, creating a round key for |
|
167 each round. |
165 </p><dl> |
168 </p><dl> |
166 <dt><i>state</i></dt> |
169 <dt><i>state</i></dt> |
167 <dd> |
170 <dd> |
168 state to be worked on (bytearray) |
171 state to be worked on (bytearray) |
169 </dd><dt><i>expandedKey</i></dt> |
172 </dd><dt><i>expandedKey</i></dt> |
180 </dd> |
183 </dd> |
181 </dl><a NAME="AES.__aes_invRound" ID="AES.__aes_invRound"></a> |
184 </dl><a NAME="AES.__aes_invRound" ID="AES.__aes_invRound"></a> |
182 <h4>AES.__aes_invRound</h4> |
185 <h4>AES.__aes_invRound</h4> |
183 <b>__aes_invRound</b>(<i>state, roundKey</i>) |
186 <b>__aes_invRound</b>(<i>state, roundKey</i>) |
184 <p> |
187 <p> |
185 Private method to apply the 4 operations of the inverse round in sequence. |
188 Private method to apply the 4 operations of the inverse round in |
|
189 sequence. |
186 </p><dl> |
190 </p><dl> |
187 <dt><i>state</i></dt> |
191 <dt><i>state</i></dt> |
188 <dd> |
192 <dd> |
189 state to be worked on (bytearray) |
193 state to be worked on (bytearray) |
190 </dd><dt><i>roundKey</i></dt> |
194 </dd><dt><i>roundKey</i></dt> |
198 </dd> |
202 </dd> |
199 </dl><a NAME="AES.__aes_main" ID="AES.__aes_main"></a> |
203 </dl><a NAME="AES.__aes_main" ID="AES.__aes_main"></a> |
200 <h4>AES.__aes_main</h4> |
204 <h4>AES.__aes_main</h4> |
201 <b>__aes_main</b>(<i>state, expandedKey, nbrRounds</i>) |
205 <b>__aes_main</b>(<i>state, expandedKey, nbrRounds</i>) |
202 <p> |
206 <p> |
203 Private method to perform the initial operations, the standard round, and the |
207 Private method to do the AES encryption for one round. |
204 final operations of the forward AES, creating a round key for each round. |
208 </p><p> |
|
209 Perform the initial operations, the standard round, and the |
|
210 final operations of the forward AES, creating a round key for |
|
211 each round. |
205 </p><dl> |
212 </p><dl> |
206 <dt><i>state</i></dt> |
213 <dt><i>state</i></dt> |
207 <dd> |
214 <dd> |
208 state to be worked on (bytearray) |
215 state to be worked on (bytearray) |
209 </dd><dt><i>expandedKey</i></dt> |
216 </dd><dt><i>expandedKey</i></dt> |
220 </dd> |
227 </dd> |
221 </dl><a NAME="AES.__aes_round" ID="AES.__aes_round"></a> |
228 </dl><a NAME="AES.__aes_round" ID="AES.__aes_round"></a> |
222 <h4>AES.__aes_round</h4> |
229 <h4>AES.__aes_round</h4> |
223 <b>__aes_round</b>(<i>state, roundKey</i>) |
230 <b>__aes_round</b>(<i>state, roundKey</i>) |
224 <p> |
231 <p> |
225 Private method to apply the 4 operations of the forward round in sequence. |
232 Private method to apply the 4 operations of the forward round in |
|
233 sequence. |
226 </p><dl> |
234 </p><dl> |
227 <dt><i>state</i></dt> |
235 <dt><i>state</i></dt> |
228 <dd> |
236 <dd> |
229 state to be worked on (bytearray) |
237 state to be worked on (bytearray) |
230 </dd><dt><i>roundKey</i></dt> |
238 </dd><dt><i>roundKey</i></dt> |
297 </dd> |
305 </dd> |
298 </dl><a NAME="AES.__galois_multiplication" ID="AES.__galois_multiplication"></a> |
306 </dl><a NAME="AES.__galois_multiplication" ID="AES.__galois_multiplication"></a> |
299 <h4>AES.__galois_multiplication</h4> |
307 <h4>AES.__galois_multiplication</h4> |
300 <b>__galois_multiplication</b>(<i>a, b</i>) |
308 <b>__galois_multiplication</b>(<i>a, b</i>) |
301 <p> |
309 <p> |
302 Private method to perform a Galois multiplication of 8 bit characters a and b. |
310 Private method to perform a Galois multiplication of 8 bit characters |
|
311 a and b. |
303 </p><dl> |
312 </p><dl> |
304 <dt><i>a</i></dt> |
313 <dt><i>a</i></dt> |
305 <dd> |
314 <dd> |
306 first factor (byte) |
315 first factor (byte) |
307 </dd><dt><i>b</i></dt> |
316 </dd><dt><i>b</i></dt> |
360 </dd> |
369 </dd> |
361 </dl><a NAME="AES.__mixColumn" ID="AES.__mixColumn"></a> |
370 </dl><a NAME="AES.__mixColumn" ID="AES.__mixColumn"></a> |
362 <h4>AES.__mixColumn</h4> |
371 <h4>AES.__mixColumn</h4> |
363 <b>__mixColumn</b>(<i>column, isInv</i>) |
372 <b>__mixColumn</b>(<i>column, isInv</i>) |
364 <p> |
373 <p> |
365 Private method to perform a galois multiplication of 1 column the 4x4 matrix. |
374 Private method to perform a galois multiplication of 1 column the |
|
375 4x4 matrix. |
366 </p><dl> |
376 </p><dl> |
367 <dt><i>column</i></dt> |
377 <dt><i>column</i></dt> |
368 <dd> |
378 <dd> |
369 column to be worked on (bytearray) |
379 column to be worked on (bytearray) |
370 </dd><dt><i>isInv</i></dt> |
380 </dd><dt><i>isInv</i></dt> |
398 <h4>AES.__rotate</h4> |
408 <h4>AES.__rotate</h4> |
399 <b>__rotate</b>(<i>data</i>) |
409 <b>__rotate</b>(<i>data</i>) |
400 <p> |
410 <p> |
401 Private method performing Rijndael's key schedule rotate operation. |
411 Private method performing Rijndael's key schedule rotate operation. |
402 </p><p> |
412 </p><p> |
403 Rotate the data word eight bits to the left: eg, rotate(1d2c3a4f) == 2c3a4f1d. |
413 Rotate the data word eight bits to the left: eg, |
|
414 rotate(1d2c3a4f) == 2c3a4f1d. |
404 </p><dl> |
415 </p><dl> |
405 <dt><i>data</i></dt> |
416 <dt><i>data</i></dt> |
406 <dd> |
417 <dd> |
407 data of size 4 (bytearray) |
418 data of size 4 (bytearray) |
408 </dd> |
419 </dd> |
451 </dd> |
462 </dd> |
452 </dl><a NAME="AES.__subBytes" ID="AES.__subBytes"></a> |
463 </dl><a NAME="AES.__subBytes" ID="AES.__subBytes"></a> |
453 <h4>AES.__subBytes</h4> |
464 <h4>AES.__subBytes</h4> |
454 <b>__subBytes</b>(<i>state, isInv</i>) |
465 <b>__subBytes</b>(<i>state, isInv</i>) |
455 <p> |
466 <p> |
456 Private method to substitute all the values from the state with the value in |
467 Private method to substitute all the values from the state with the |
457 the SBox using the state value as index for the SBox. |
468 value in the SBox using the state value as index for the SBox. |
458 </p><dl> |
469 </p><dl> |
459 <dt><i>state</i></dt> |
470 <dt><i>state</i></dt> |
460 <dd> |
471 <dd> |
461 state to be worked on (bytearray) |
472 state to be worked on (bytearray) |
462 </dd><dt><i>isInv</i></dt> |
473 </dd><dt><i>isInv</i></dt> |
470 </dd> |
481 </dd> |
471 </dl><a NAME="AES.decrypt" ID="AES.decrypt"></a> |
482 </dl><a NAME="AES.decrypt" ID="AES.decrypt"></a> |
472 <h4>AES.decrypt</h4> |
483 <h4>AES.decrypt</h4> |
473 <b>decrypt</b>(<i>iput, key, size</i>) |
484 <b>decrypt</b>(<i>iput, key, size</i>) |
474 <p> |
485 <p> |
475 Public method to decrypt a 128 bit input block against the given key of size |
486 Public method to decrypt a 128 bit input block against the given key |
476 specified. |
487 of size specified. |
477 </p><dl> |
488 </p><dl> |
478 <dt><i>iput</i></dt> |
489 <dt><i>iput</i></dt> |
479 <dd> |
490 <dd> |
480 input data (bytearray) |
491 input data (bytearray) |
481 </dd><dt><i>key</i></dt> |
492 </dd><dt><i>key</i></dt> |
492 </dd> |
503 </dd> |
493 </dl><a NAME="AES.encrypt" ID="AES.encrypt"></a> |
504 </dl><a NAME="AES.encrypt" ID="AES.encrypt"></a> |
494 <h4>AES.encrypt</h4> |
505 <h4>AES.encrypt</h4> |
495 <b>encrypt</b>(<i>iput, key, size</i>) |
506 <b>encrypt</b>(<i>iput, key, size</i>) |
496 <p> |
507 <p> |
497 Public method to encrypt a 128 bit input block against the given key of size |
508 Public method to encrypt a 128 bit input block against the given key |
498 specified. |
509 of size specified. |
499 </p><dl> |
510 </p><dl> |
500 <dt><i>iput</i></dt> |
511 <dt><i>iput</i></dt> |
501 <dd> |
512 <dd> |
502 input data (bytearray) |
513 input data (bytearray) |
503 </dd><dt><i>key</i></dt> |
514 </dd><dt><i>key</i></dt> |
660 <dt><i>key</i></dt> |
671 <dt><i>key</i></dt> |
661 <dd> |
672 <dd> |
662 key to be used for decryption (bytes) |
673 key to be used for decryption (bytes) |
663 </dd><dt><i>data</i></dt> |
674 </dd><dt><i>data</i></dt> |
664 <dd> |
675 <dd> |
665 data to be decrypted (with initialization vector prepended) (bytes) |
676 data to be decrypted (with initialization vector prepended) |
|
677 (bytes) |
666 </dd><dt><i>mode</i></dt> |
678 </dd><dt><i>mode</i></dt> |
667 <dd> |
679 <dd> |
668 mode of operations (0, 1 or 2) |
680 mode of operations (0, 1 or 2) |
669 </dd> |
681 </dd> |
670 </dl><dl> |
682 </dl><dl> |