Module myAES.AES
Module for AES encrpytion/decryption
Classes
class AES (printStuff: bool = False)
-
Create console for printing and instantiate encryptions box keys
Methods
def GFdot(self, a: list, b: list) ‑> int
-
perform dot product on binary galois field objects
def GFmatMul(self, a: list, b: list) ‑> list
-
perform matrix multiplication on matrices with GF2 elements
def addRoundKey(self, m: list, key: list) ‑> list
-
adds this rounds key to working matrix
def byteSub(self, m: list) ‑> list
-
do…
def byteSubInv(self, m: list) ‑> list
-
Given a matrix, do…
def byteToNibbles(self, byte: int) ‑> tuple
-
breaks a byte into a tuple of nibbles
def decrypt(self, ct: list, key: list, numrounds: int) ‑> list
-
perform decryption
def encrypt(self, pt: list, key: list, numrounds: int) ‑> list
-
perform encryption
def generateKeyMat(self, key: list) ‑> list
-
given a key, will generate a matrix for AES
def generateKeys(self, key: list) ‑> list
-
given a key, will generate future rounds keys
def generateRoundKey(self, key: list, round: int) ‑> list
-
Generate a rounds key based on the initial key
def getCol(self, m: list, c: int) ‑> list
-
get a column from the matrix as a list
def getCtString(self) ‑> str
-
Get cipher text string
def getPtString(self) ‑> str
-
Get plain text string
def keyTransform(self, k: list, n: int) ‑> list
-
will take a 1d list, left shift it, apply sbox to it
def listXOR(self, a: list, b: list) ‑> list
-
XOR of list of bits
def makeMat(self, pt: list) ‑> list
-
Make a 2d list based off of the bits of the plain text given
def mixCol(self, m: list) ‑> list
-
performs mix column method on working matrix
def mixColInv(self, m: list) ‑> list
-
given a matrix, perform inverse GF matrix multiplication
def printHexMatrix(self, t: list) ‑> None
def shiftLeft(self, r: list, n: int) ‑> list
-
given a list and number of shifts, performs shifts and returns new list
def shiftRight(self, r: list, n: int) ‑> list
-
given list and number of shifts, perform shifts and return new list
def shiftRow(self, m: list) ‑> list
-
shift matrix rows down
def shiftRowInv(self, m: list) ‑> list
-
Given a matrix, shift rows up
def transposeMat(self, m: list) ‑> list
-
given a matrix, returns that matrix transposed