Module Expr Str ImportFrom alias Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body If CompareEq NameLoad NameLoad body Return Call NameLoad Call NameLoad NameLoad orelse If CompareEq NameLoad NameLoad body If CompareIs NameLoad NameLoad body Raise Call NameLoad Str Return Call NameLoad Call NameLoad NameLoad NameLoad orelse Raise NameLoad decorator_list ClassDef bases NameLoad body Assign NameStore Num FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad If CompareEq AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr Num orelse If CompareEq AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr Num orelse If CompareEq AttributeLoad NameLoad attr Num body Assign AttributeStore NameLoad attr Num orelse Raise Call NameLoad Str Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad Str AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Num orelse If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Num orelse Assign NameStore Num Assign NameStore SubscriptLoad NameLoad Slice Num For NameStore Call NameLoad Num Num body Assign NameStore BinOpAdd SubscriptLoad NameLoad Slice Num Num SubscriptLoad NameLoad Slice Num Num For NameStore Call NameLoad Num body Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index Num BinOpBitXor SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index NameLoad For NameStore Call NameLoad Num body For NameStore Call NameLoad Num body AugAssignBitXor SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd UnaryOpUSub AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareGtE Call NameLoad NameLoad BinOpMult BinOpAdd AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr body Break If CompareEq AttributeLoad NameLoad attr Num body For NameStore Call NameLoad Num body Assign SubscriptStore NameLoad Index NameLoad BinOpBitXor SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd UnaryOpUSub AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad Num body AugAssignBitXor SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd UnaryOpUSub AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore BinOpMult NameLoad Num Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad Num body AugAssignBitXor SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str For NameStore Call NameLoad Num body Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign TupleStore SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num SubscriptStore NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad For NameStore Call NameLoad Num body Assign NameStore BinOpMult NameLoad Num Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num Assign SubscriptStore NameLoad Index NameLoad BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad For NameStore Call NameLoad Num body Assign NameStore BinOpMult NameLoad Num Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num Assign SubscriptStore NameLoad Index NameLoad BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpAdd NameLoad Num BinOpBitXor BinOpBitXor BinOpBitXor SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad Num For NameStore Call NameLoad Num AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr For NameStore Call NameLoad BinOpSub AttributeLoad NameLoad attr Num Num Num body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If CompareNotEq BinOpMod Call NameLoad NameLoad AttributeLoad NameLoad attr Num body Raise Call NameLoad Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call NameLoad Str NameLoad For NameStore Call NameLoad Num Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad Expr Call NameLoad NameLoad Assign SubscriptStore NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad NameLoad Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareNotEq BinOpMod Call NameLoad NameLoad NameLoad Num body Raise Call NameLoad Str Assign NameStore Call NameLoad Str NameLoad Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad Num Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad For NameStore Call NameLoad NameLoad body AugAssignBitXor SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad NameLoad Assign NameStore NameLoad Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore AttributeLoad NameLoad attr If CompareNotEq BinOpMod Call NameLoad NameLoad NameLoad Num body Raise Call NameLoad Str Assign NameStore Call NameLoad Str NameLoad Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad Num Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Slice Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore Call NameLoad NameLoad body AugAssignBitXor SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Slice NameLoad BinOpAdd NameLoad NameLoad NameLoad Assign NameStore NameLoad Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Num While NameLoad body If BinOpBitAnd NameLoad Num body AugAssignBitXor NameStore NameLoad AugAssignLShift NameStore Num If BinOpBitAnd NameLoad Num body AugAssignBitXor NameStore Num AugAssignRShift NameStore Num Return BinOpBitAnd NameLoad Num decorator_list Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str ListComp Call NameLoad NameLoad Num comprehension NameStore Call NameLoad Num Assign NameStore Call NameLoad Str Call AttributeLoad Str attr Str Assign NameStore Call NameLoad Str Call AttributeLoad Str attr Str Assign NameStore Call NameLoad Str Call AttributeLoad Str attr Str
N/A N/A Simple AES cipher implementation in pure Python following PEP-272 API

Homepage: https://bitbucket.org/intgr/pyaes/

The goal of this module is to be as fast as reasonable in Python while still
being Pythonic and readable/understandable. It is licensed under the permissive
MIT license.

Hopefully the code is readable and commented enough that it can serve as an
introduction to the AES cipher for Python coders. In fact, it should go along
well with the Stick Figure Guide to AES:
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html

Contrary to intuition, this implementation numbers the 4x4 matrices from top to
bottom for efficiency reasons::

  0  4  8 12
  1  5  9 13
  2  6 10 14
  3  7 11 15

Effectively it's the transposition of what you'd expect. This actually makes
the code simpler -- except the ShiftRows step, but hopefully the explanation
there clears it up.

 array array N/A MODE_ECB 1 N/A MODE_CBC 2 N/A block_size 16 N/A key_size None new N/A N/A key mode IV N/A MODE_CBC None N/A N/A N/A mode MODE_ECB N/A N/A N/A ECBMode N/A AES key N/A N/A N/A mode MODE_CBC N/A N/A N/A IV None N/A N/A N/A ValueError CBC mode needs an IV value! N/A N/A CBCMode N/A AES key IV N/A N/A NotImplementedError N/A AES N/A object N/A N/A block_size 16 __init__ N/A N/A self key N/A N/A N/A N/A N/A self setkey key N/A setkey N/A N/A self key N/A N/A N/A Sets the key and performs key expansion. N/A N/A self key key N/A N/A self key_size N/A len key N/A N/A N/A self key_size 16 N/A N/A N/A self rounds 10 N/A N/A N/A N/A self key_size 24 N/A N/A N/A self rounds 12 N/A N/A N/A N/A self key_size 32 N/A N/A N/A self rounds 14 N/A N/A N/A ValueError Key length must be 16, 24 or 32 bytes N/A N/A N/A self expand_key N/A expand_key N/A N/A self N/A N/A N/A Performs AES key expansion on self.key and stores in self.exkey N/A exkey N/A array B N/A self key N/A N/A N/A self key_size 16 N/A N/A extra_cnt 0 N/A N/A N/A N/A self key_size 24 N/A N/A extra_cnt 2 N/A N/A extra_cnt 3 N/A word N/A exkey N/A -4 N/A i N/A xrange 1 11 N/A N/A word N/A N/A word N/A 1 4 N/A word N/A 0 1 N/A j N/A xrange 4 N/A N/A N/A word N/A j N/A aes_sbox N/A N/A word N/A j N/A N/A word N/A 0 N/A N/A word N/A 0 N/A aes_Rcon N/A i N/A z N/A xrange 4 N/A N/A j N/A xrange 4 N/A N/A N/A word N/A j N/A exkey N/A N/A N/A N/A self key_size j N/A N/A N/A exkey extend word N/A N/A N/A len exkey N/A N/A N/A self rounds 1 N/A self block_size N/A N/A N/A N/A N/A self key_size 32 N/A N/A j N/A xrange 4 N/A N/A N/A word N/A j N/A N/A aes_sbox N/A N/A word N/A j N/A exkey N/A N/A N/A N/A self key_size j N/A N/A N/A exkey extend word N/A z N/A xrange extra_cnt N/A N/A j N/A xrange 4 N/A N/A N/A word N/A j N/A exkey N/A N/A N/A N/A self key_size j N/A N/A N/A exkey extend word N/A N/A self exkey exkey N/A add_round_key N/A N/A self block round N/A N/A N/A AddRoundKey step in AES. This is where the key is mixed into plaintext N/A offset N/A round 16 N/A exkey N/A self exkey N/A i N/A xrange 16 N/A N/A N/A block N/A i N/A exkey N/A N/A offset i N/A sub_bytes N/A N/A self block sbox N/A N/A N/A SubBytes step, apply S-box to all bytes

        Depending on whether encrypting or decrypting, a different sbox array
        is passed in.
         N/A i N/A xrange 16 N/A N/A N/A block N/A i N/A sbox N/A N/A block N/A i N/A shift_rows N/A N/A self b N/A N/A N/A ShiftRows step. Shifts 2nd row to left by 1, 3rd row by 2, 4th row by 3

        Since we're performing this on a transposed matrix, cells are numbered
        from top to bottom::

          0  4  8 12   ->    0  4  8 12    -- 1st row doesn't change
          1  5  9 13   ->    5  9 13  1    -- row shifted to left by 1 (wraps around)
          2  6 10 14   ->   10 14  2  6    -- shifted by 2
          3  7 11 15   ->   15  3  7 11    -- shifted by 3
         N/A N/A N/A b N/A 1 N/A b N/A 5 N/A b N/A 9 N/A b N/A 13 N/A N/A b N/A 5 N/A b N/A 9 N/A b N/A 13 N/A b N/A 1 N/A N/A N/A b N/A 2 N/A b N/A 6 N/A b N/A 10 N/A b N/A 14 N/A N/A b N/A 10 N/A b N/A 14 N/A b N/A 2 N/A b N/A 6 N/A N/A N/A b N/A 3 N/A b N/A 7 N/A b N/A 11 N/A b N/A 15 N/A N/A b N/A 15 N/A b N/A 3 N/A b N/A 7 N/A b N/A 11 N/A shift_rows_inv N/A N/A self b N/A N/A N/A Similar to shift_rows above, but performed in inverse for decryption. N/A N/A N/A b N/A 5 N/A b N/A 9 N/A b N/A 13 N/A b N/A 1 N/A N/A b N/A 1 N/A b N/A 5 N/A b N/A 9 N/A b N/A 13 N/A N/A N/A b N/A 10 N/A b N/A 14 N/A b N/A 2 N/A b N/A 6 N/A N/A b N/A 2 N/A b N/A 6 N/A b N/A 10 N/A b N/A 14 N/A N/A N/A b N/A 15 N/A b N/A 3 N/A b N/A 7 N/A b N/A 11 N/A N/A b N/A 3 N/A b N/A 7 N/A b N/A 11 N/A b N/A 15 N/A mix_columns N/A N/A self block N/A N/A N/A MixColumns step. Mixes the values in each column N/A mul_by_2 gf_mul_by_2 N/A mul_by_3 gf_mul_by_3 N/A i N/A xrange 4 N/A N/A col N/A i 4 N/A N/A v0 v1 v2 v3 N/A N/A block N/A col N/A block N/A N/A col 1 N/A block N/A N/A col 2 N/A block N/A N/A col 3 N/A N/A block N/A col N/A N/A N/A N/A mul_by_2 N/A v0 v3 v2 N/A mul_by_3 N/A v1 N/A N/A block N/A N/A col 1 N/A N/A N/A N/A mul_by_2 N/A v1 v0 v3 N/A mul_by_3 N/A v2 N/A N/A block N/A N/A col 2 N/A N/A N/A N/A mul_by_2 N/A v2 v1 v0 N/A mul_by_3 N/A v3 N/A N/A block N/A N/A col 3 N/A N/A N/A N/A mul_by_2 N/A v3 v2 v1 N/A mul_by_3 N/A v0 N/A mix_columns_inv N/A N/A self block N/A N/A N/A Similar to mix_columns above, but performed in inverse for decryption. N/A mul_9 gf_mul_by_9 N/A mul_11 gf_mul_by_11 N/A mul_13 gf_mul_by_13 N/A mul_14 gf_mul_by_14 N/A i N/A xrange 4 N/A N/A col N/A i 4 N/A N/A v0 v1 v2 v3 N/A N/A block N/A col N/A block N/A N/A col 1 N/A block N/A N/A col 2 N/A block N/A N/A col 3 N/A N/A block N/A col N/A N/A N/A N/A mul_14 N/A v0 N/A mul_9 N/A v3 N/A mul_13 N/A v2 N/A mul_11 N/A v1 N/A N/A block N/A N/A col 1 N/A N/A N/A N/A mul_14 N/A v1 N/A mul_9 N/A v0 N/A mul_13 N/A v3 N/A mul_11 N/A v2 N/A N/A block N/A N/A col 2 N/A N/A N/A N/A mul_14 N/A v2 N/A mul_9 N/A v1 N/A mul_13 N/A v0 N/A mul_11 N/A v3 N/A N/A block N/A N/A col 3 N/A N/A N/A N/A mul_14 N/A v3 N/A mul_9 N/A v2 N/A mul_13 N/A v1 N/A mul_11 N/A v0 N/A encrypt_block N/A N/A self block N/A N/A N/A Encrypts a single block. This is the main AES function N/A N/A N/A self add_round_key block 0 N/A round N/A xrange 1 N/A self rounds N/A N/A N/A N/A self sub_bytes block aes_sbox N/A N/A N/A self shift_rows block N/A N/A N/A self mix_columns block N/A N/A N/A self add_round_key block round N/A N/A N/A self sub_bytes block aes_sbox N/A N/A N/A self shift_rows block N/A N/A N/A self add_round_key block N/A self rounds N/A decrypt_block N/A N/A self block N/A N/A N/A Decrypts a single block. This is the main AES decryption function N/A N/A N/A self add_round_key block N/A self rounds N/A round N/A xrange N/A N/A self rounds 1 0 -1 N/A N/A N/A N/A self shift_rows_inv block N/A N/A N/A self sub_bytes block aes_inv_sbox N/A N/A N/A self add_round_key block round N/A N/A N/A self mix_columns_inv block N/A N/A N/A self shift_rows_inv block N/A N/A N/A self sub_bytes block aes_inv_sbox N/A N/A N/A self add_round_key block 0 N/A N/A ECBMode N/A object N/A N/A Electronic CodeBook (ECB) mode encryption.

    Basically this mode applies the cipher function to each block individually;
    no feedback is done. NB! This is insecure for almost all purposes
     __init__ N/A N/A self cipher N/A N/A N/A N/A self cipher cipher N/A N/A self block_size N/A cipher block_size N/A ecb N/A N/A self data block_func N/A N/A N/A Perform ECB mode with the given function N/A N/A N/A N/A len data N/A self block_size 0 N/A N/A N/A ValueError Plaintext length must be multiple of 16 N/A block_size N/A self block_size N/A data N/A array B data N/A offset N/A xrange 0 N/A len data block_size N/A N/A block N/A data N/A offset N/A offset block_size N/A N/A block_func block N/A N/A data N/A offset N/A offset block_size block N/A N/A N/A data tostring N/A encrypt N/A N/A self data N/A N/A N/A Encrypt data in ECB mode N/A N/A N/A self ecb data N/A N/A self cipher encrypt_block N/A decrypt N/A N/A self data N/A N/A N/A Decrypt data in ECB mode N/A N/A N/A self ecb data N/A N/A self cipher decrypt_block N/A N/A CBCMode N/A object N/A N/A Cipher Block Chaining (CBC) mode encryption. This mode avoids content leaks.

    In CBC encryption, each plaintext block is XORed with the ciphertext block
    preceding it; decryption is simply the inverse.
     __init__ N/A N/A self cipher IV N/A N/A N/A N/A self cipher cipher N/A N/A self block_size N/A cipher block_size N/A N/A self IV N/A array B IV N/A encrypt N/A N/A self data N/A N/A N/A Encrypt data in CBC mode N/A block_size N/A self block_size N/A N/A N/A N/A len data block_size 0 N/A N/A N/A ValueError Plaintext length must be multiple of 16 N/A data N/A array B data N/A IV N/A self IV N/A offset N/A xrange 0 N/A len data block_size N/A N/A block N/A data N/A offset N/A offset block_size N/A i N/A xrange block_size N/A N/A N/A block N/A i N/A IV N/A i N/A N/A N/A N/A self cipher encrypt_block block N/A N/A data N/A offset N/A offset block_size block N/A IV block N/A N/A self IV IV N/A N/A N/A data tostring N/A decrypt N/A N/A self data N/A N/A N/A Decrypt data in CBC mode N/A block_size N/A self block_size N/A N/A N/A N/A len data block_size 0 N/A N/A N/A ValueError Ciphertext length must be multiple of 16 N/A data N/A array B data N/A IV N/A self IV N/A offset N/A xrange 0 N/A len data block_size N/A N/A ctext N/A data N/A offset N/A offset block_size N/A block N/A ctext N/A N/A N/A N/A N/A self cipher decrypt_block block N/A i N/A xrange block_size N/A N/A N/A block N/A i N/A IV N/A i N/A N/A data N/A offset N/A offset block_size block N/A IV ctext N/A N/A self IV IV N/A N/A N/A data tostring N/A N/A galois_multiply N/A N/A a b N/A N/A N/A Galois Field multiplicaiton for AES N/A p 0 N/A b N/A N/A N/A b 1 N/A N/A p a N/A a 1 N/A N/A a 256 N/A N/A a 27 N/A b 1 N/A N/A p 255 N/A N/A gf_mul_by_2 N/A array B N/A N/A galois_multiply x 2 N/A x N/A range 256 N/A gf_mul_by_3 N/A array B N/A N/A galois_multiply x 3 N/A x N/A range 256 N/A gf_mul_by_9 N/A array B N/A N/A galois_multiply x 9 N/A x N/A range 256 N/A gf_mul_by_11 N/A array B N/A N/A galois_multiply x 11 N/A x N/A range 256 N/A gf_mul_by_13 N/A array B N/A N/A galois_multiply x 13 N/A x N/A range 256 N/A gf_mul_by_14 N/A array B N/A N/A galois_multiply x 14 N/A x N/A range 256 N/A aes_sbox N/A array B N/A N/A 637c777bf26b6fc53001672bfed7ab76ca82c97dfa5947f0add4a2af9ca472c0b7fd9326363ff7cc34a5e5f171d8311504c723c31896059a071280e2eb27b27509832c1a1b6e5aa0523bd6b329e32f8453d100ed20fcb15b6acbbe394a4c58cfd0efaafb434d338545f9027f503c9fa851a3408f929d38f5bcb6da2110fff3d2cd0c13ec5f974417c4a77e3d645d197360814fdc222a908846eeb814de5e0bdbe0323a0a4906245cc2d3ac629195e479e7c8376d8dd54ea96c56f4ea657aae08ba78252e1ca6b4c6e8dd741f4bbd8b8a703eb5664803f60e613557b986c11d9ee1f8981169d98e949b1e87e9ce5528df8ca1890dbfe6426841992d0fb054bb16 decode hex N/A aes_inv_sbox N/A array B N/A N/A 52096ad53036a538bf40a39e81f3d7fb7ce339829b2fff87348e4344c4dee9cb547b9432a6c2233dee4c950b42fac34e082ea16628d924b2765ba2496d8bd12572f8f66486689816d4a45ccc5d65b6926c704850fdedb9da5e154657a78d9d8490d8ab008cbcd30af7e45805b8b34506d02c1e8fca3f0f02c1afbd0301138a6b3a9111414f67dcea97f2cfcef0b4e67396ac7422e7ad3585e2f937e81c75df6e47f11a711d29c5896fb7620eaa18be1bfc563e4bc6d279209adbc0fe78cd5af41fdda8338807c731b11210592780ec5f60517fa919b54a0d2de57a9f93c99cefa0e03b4dae2af5b0c8ebbb3c83539961172b047eba77d626e169146355210c7d decode hex N/A aes_Rcon N/A array B N/A N/A 8d01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc5913972e4d3bd61c29f254a943366cc831d3a74e8cb8d01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc5913972e4d3bd61c29f254a943366cc831d3a74e8cb8d01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc5913972e4d3bd61c29f254a943366cc831d3a74e8cb8d01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc5913972e4d3bd61c29f254a943366cc831d3a74e8cb8d01020408102040801b366cd8ab4d9a2f5ebc63c697356ad4b37dfaefc5913972e4d3bd61c29f254a943366cc831d3a74e8cb decode hex