cascada.primitives.aes module

AES-128.

A WeakModel is used to model the XOR and linear models of the S-box, and a BranchNumberModel is used to model the XOR and linear models of MixColumns.

AES source: https://csrc.nist.gov/csrc/media/publications/fips/197/final/documents/fips-197.pdf

class cascada.primitives.aes.AESKeySchedule(*args, **options)[source]

Bases: cascada.bitvector.ssa.RoundBasedFunction

Key schedule of AES-128.

classmethod set_num_rounds(new_num_rounds)[source]

Set RoundBasedFunction.num_rounds and update input_widths and output_widths if necessary.

classmethod eval(*master_key)[source]

Evaluate the function (internal method).

classmethod test()[source]

Test the key-schedule of AES-128 with official test vectors.

class cascada.primitives.aes.SboxLut(**kwargs)[source]

Bases: cascada.bitvector.secondaryop.LutOperation

The 8-bit S-box of AES.

linear_model

alias of cascada.linear.opmodel.get_weak_model.<locals>.MyWeakModel

xor_model

alias of cascada.differential.opmodel.get_weak_model.<locals>.MyWeakModel

class cascada.primitives.aes.MixColumnsBitMatrix(**kwargs)[source]

Bases: cascada.bitvector.secondaryop.MatrixOperation

The (32, 32) binary matrix representing MixColumns.

linear_model

alias of cascada.linear.opmodel.get_branch_number_model.<locals>.MyBranchNumberModel

xor_model

alias of cascada.differential.opmodel.get_branch_number_model.<locals>.MyBranchNumberModel

class cascada.primitives.aes.AESEncryption(*args, **options)[source]

Bases: cascada.primitives.blockcipher.Encryption, cascada.primitives.aes_like.AESLikeFunction

Encryption function of AES-128.

sbox

alias of cascada.primitives.aes.SboxLut

mix_columns_bit_matrix

alias of cascada.primitives.aes.MixColumnsBitMatrix

classmethod eval(*plaintext)[source]

Evaluate the function (internal method).

class cascada.primitives.aes.AESCipher(plaintext, masterkey, **options)[source]

Bases: cascada.primitives.blockcipher.Cipher

The block cipher AES-128.

key_schedule

alias of cascada.primitives.aes.AESKeySchedule

encryption

alias of cascada.primitives.aes.AESEncryption

classmethod set_num_rounds(new_num_rounds)[source]

Call RoundBasedFunction.set_num_rounds of key_schedule and encryption (if iterated).