Back to projects

Technical depth / education

Block ciphers implemented from scratch

EE5001 Applied Cryptography coursework. PRESENT-80 (lightweight, ISO/IEC 29192-2, designed for IoT-class hardware) and AES-128 (FIPS 197) implemented from scratch in Python, with test vectors. The point was to see the substitution-permutation networks and key schedules end-to-end, not to ship production crypto.

Employer / client
Dublin City University
Duration
EE5001, 2024
Project type
Security lab

How it works

How this works

Block diagram of the PRESENT-80 cipher. 64-bit plaintext flows through 31 rounds, each round being addRoundKey, then sBoxLayer (16 parallel 4-bit S-boxes), then pLayer (64-bit permutation). After 31 rounds a final addRoundKey produces the 64-bit ciphertext. The 80-bit key feeds a key-schedule block that produces 32 64-bit round keys.

PRESENT-80 round structure: 31 rounds of addRoundKey → sBoxLayer → pLayer, plus a final addRoundKey. The 80-bit key produces 32 round keys via the key schedule.

Built from the PRESENT spec (Bogdanov et al., 2007)

How I built it

  • Worked through the bit-level operations, S-boxes, P-layer, and key expansion with reproducible test harnesses.
  • PRESENT-80 vs AES-128 comparison: AES has much wider security analysis and bigger margins; PRESENT is about 5x smaller in hardware area and tractable on an MSP432, which is why ISO standardised it as 29192-2.
  • Useful frame for later CRM and integration work: knowing what you're actually trusting when you say "encrypted" or "governed".

Measured results

What I measured

2 evidence

ciphers implemented

Working PRESENT-80 encrypt path with test-vector verification (plaintext 0x0000...0000, key 0x0000...0000, ciphertext 0x5579c1387b228445).

Findings

  • Working PRESENT-80 encrypt path with test-vector verification (plaintext 0x0000...0000, key 0x0000...0000, ciphertext 0x5579c1387b228445).
  • Working AES-128 encrypt path against the FIPS 197 test vector (plaintext 0x00112233...eeff, key 0x00010203...0e0f, ciphertext 0x69c4e0d8...4154).
  • Wrote up where library crypto is non-negotiable in real systems and where the educational bit stops.

Tools I used

  • Python
  • PRESENT-80
  • AES-128
  • FIPS 197
  • ISO/IEC 29192-2