Skip to content

[FEATURE] Add XTEA Block Cipher Module #252

Description

@Aakif-Kohari

Summary

CryptoViz's Symmetric category has classical-era (DES/3DES) and modern (AES/ChaCha20) block/stream ciphers but nothing from the ARX Feistel family used widely in embedded/lightweight contexts. XTEA (eXtended TEA, Wheeler & Needham 1997) is a compact, well-documented 64-round Feistel cipher using only add/XOR/shift — no S-boxes or lookup tables — making it a clean, low-risk addition with high pedagogical value (contrasts nicely with DES's table-heavy design).

What's missing

  • No lib/cipher/symmetric/xtea.ts
  • Not in registry, worker router, or CipherName type

Proposed implementation

  • 64-bit block (two 32-bit words), 128-bit key (four 32-bit words), 32 double-rounds (64 total), DELTA = 0x9E3779B9
  • Pure ARX round function: ((x<<4)^(x>>5)) + x, no fixed tables
  • Decrypt runs the identical round function in reverse iteration order with sum initialized to DELTA*32 — no separate inverse-key derivation needed (unlike DES/AES), which keeps the implementation and its instrumentation simple
  • Security status: secure (educational note: 64-bit block size is small by modern standards; superseded by ChaCha20/AES for new designs)
  • Test vectors (independently verified, round-trip confirmed):
    • key 000102030405060708090A0B0C0D0E0F, plaintext 4142434445464748 → ciphertext 497DF3D072612CB5
    • key 00000000000000000000000000000000 (all-zero), plaintext 0000000000000000 → ciphertext DEE9D4D8F7131ED9

Acceptance criteria

  • Matches both listed test vectors exactly
  • Round-trip encrypt→decrypt correct for arbitrary 8-byte-aligned input
  • Vitest unit + fast-check fuzz test
  • Registered in registry/worker/CipherName type
  • Dark/light mode support via existing theme system (no new styling needed)

Assignment

I'd like to work on this issue under ECSoC26. Will open a PR only after approval/assignment by @csxark or another maintainer.

Metadata

Metadata

Assignees

Labels

ECSoC26Elite Coders Summer of Code 2026

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions