• Number Theory
    • Integers
    • Modular Arithmetic
    • GCD
  • Abstract Algebra
    • Groups
    • Rings
    • Fields
    • Galois Fields
  • Probability and Information Theory
    • Probability
    • Entropy

Number Theory

Integers

  • If and then for all
  • if and then

Modular Arithmetic

  • and
  • equivalence class: set of all integers congruent to
  • residue: the remainder between and

GCD

  • Euclidean Division Algorithm:
def gcd(a, b):
  if a < b:
    swap(a, b)
  while a > b:
    r = a % b
    if r == 0:
      break
    else:
      a = b
      b = r
  return b
  • Bezout’s Identity: such that
  • Extended Euclidean Algorithm: to find value of in identity above

Abstract Algebra

Groups

group consists of set and binary operation on satisfying three axioms

  • (associative)
  • (identity) such that
  • (inverse) such that

Rings

ring

  • is an abelian group
  • (associative) operation is associative
  • (identity) operation has an identity
  • (distributive) is distributive over .

Fields

Field

  • is a group
  • is a group
  • distributivity holds

i.e rings with both additive group and multiplicative group

THEOREM

A field with order only exists if is a prime power i.e. for some positive integer and prime integer . is called the characteristic of the finite field

Galois Fields

Prime Fields

These are fields of prime power

e.g. is the ring . if is prime then is a prime field.

e.g. is the smallest finite field =

  • Arithmetic is addition modulo 2 XOR
  • Multiplication modulo 2 is just logical AND

Extension Fields

In AES the finite field contains 256 elements (prime power)

Clearly this is not a prime field so we can’t directly use XOR and AND.

  • We will call this an extension field and represent its elements as polynomials with defined polynomial arithmetic
  • coefficients of the polynomials belong to
  • the maximum degree of is for coefficients

Addition and Subtraction in

bitwise XOR

NOTE

subtraction of two polynomials gives the same result as addition

Multiplication in

  • standard polynomial multiplication
  • coefficients mod 2
  • reduce since degree probably increased
    • divide by irreducible polynomial (prime number equivalent of a polynomial)

where is an irreducible polynomial

NOTE

for AES the irreducible polynomial is used

Inversion in

The main algorithm is the extended euclidean algorithm. AES uses LUTs

Information Theory

Surprise Function

  • is the information content of a single message
  • you want to be more surprised if a “rare” symbol is observed
  • logarithm because information should be additive

Shannon Entropy: average information content

  • sub-additivity:
  • chain-rule:
    • conditioning can only decrease uncertainty