Skip to content

FEATURE/Add: add TRAX-L-17 tweakable block cipher - #508

Open
peacker wants to merge 1 commit into
developfrom
feature/add-trax-block-cipher
Open

FEATURE/Add: add TRAX-L-17 tweakable block cipher#508
peacker wants to merge 1 commit into
developfrom
feature/add-trax-block-cipher

Conversation

@peacker

@peacker peacker commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds TraxBlockCipher (claasp/ciphers/block_ciphers/trax_block_cipher.py), TRAX-L-17 — Beierle, Biryukov, Cardoso dos Santos et al.'s tweakable ARX block cipher from the same paper/family as Alzette and CRAX.
  • Fixed against the reference C code (traxl17_enc_ref, Appendix D.2 of the eprint):
    • ELL(x) = ROT(x ^ (x << 16), 16)x << 16 is a plain left shift, not a rotation.
    • Linear-layer word shuffle is (x3, x2, x0, x1), not a simple cyclic rotation (the reference C's sequential, not simultaneous, assignments produce a different permutation than a naive reading suggests).

Note on test vectors

No officially-published third-party KAT exists for TRAX-L-17 (only source code, no separate KAT appendix/third-party port like CRAX has). Validated against an independent line-by-line Python transcription of the designers' reference C implementation — flagged explicitly as self-derived (not third-party-published) in the class docstring and test file, with the source URL, so a reviewer can re-verify independently.

Test plan

  • sage -t claasp/ciphers/block_ciphers/trax_block_cipher.py — 10 doctests, all passed
  • pytest -v tests/unit/ciphers/block_ciphers/trax_block_cipher_test.py — 4 passed

Implements TRAX-L-17 (256-bit block, 256-bit key, 128-bit tweak, 17 steps),
Aumasson/Beierle et al.'s Alzette-based tweakable block cipher from
[BBBGPUV2020]_. Fixes two round-function bugs present in an earlier
in-progress draft: the ELL diffusion function used a rotation instead of a
true zero-filling left shift for the "v << 16" term, and the post-ELL word
shuffle used the wrong permutation of the four branches. Both are corrected
to match the designers' reference C code (traxl17_genkeys_ref /
traxl17_enc_ref, Appendix D.2 of [BBBGPUV2020]_, also published at
https://sparkle-lwc.github.io/trax), and validated bit-for-bit against an
independent Python transcription of that reference code since no
independently-published numeric test vectors for TRAX-L-17 exist.
@sonarqubecloud

Copy link
Copy Markdown

@peacker
peacker requested a review from juaninf August 24, 2026 11:25
@peacker
peacker marked this pull request as ready for review August 24, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant