Skip to content

Fix ML-KEM platform dispatch and sync AGENTS.md with the code - #31

Merged
dipu-bd merged 2 commits into
mainfrom
ccr-3e9bf447-zsxg7p
Nov 28, 2026
Merged

dipu-bd merged 2 commits into
mainfrom
ccr-3e9bf447-zsxg7p

Conversation

@dipu-bd

@dipu-bd dipu-bd commented Nov 28, 2026

Copy link
Copy Markdown
Member

Changes

Select ML-KEM 32-bit arithmetic via dart.library.js_interop

lib/src/algorithms/mlkem/arith.dart chose the 32-bit twin using only the deprecated dart.library.js condition. It now uses the same two-condition form as hashlib's dispatchers:

export 'arith_64bit.dart'
    if (dart.library.js_interop) 'arith_32bit.dart'
    if (dart.library.js) 'arith_32bit.dart';

Behavior note: dart.library.js_interop is also true on dart2wasm, so wasm builds now use the 32-bit arithmetic. Before this change they used the 64-bit version. The output is identical: the FIPS 203 KATs in test/mlkem_test.dart pass on wasm. ML-KEM may be somewhat slower on wasm, but I haven't measured it.

Update AGENTS.md to match the code

  • AES has 10 modes (CCM was missing). Blowfish and Twofish (ECB/CBC/CTR) are now listed.
  • Added the files missing from the layout: core/{blowfish,twofish,kem}.dart, stream_extensions.dart, blowfish_modes/, twofish_modes/, and mlkem/ with its _32bit/_64bit arithmetic files. Also fixed the example count and listed all three table generators.
  • The F4 rule (generated tables) now covers the Blowfish and Twofish tables, not just AES.
  • Added dart test -P wasm and the stable-only tag, and a note to run node tests when touching the ML-KEM arithmetic files.
  • Fixed the mode naming rule: CTR/CFB/OFB use a single ...ModeCipher class, and ...CipherCore exists only in GCM and CCM. The rule now covers all three block ciphers.

Verification

  • dart format --set-exit-if-changed . makes no changes
  • dart analyze --fatal-infos reports no issues
  • dart test -p vm: all 1810 tests pass
  • dart test -p node test/mlkem_test.dart test/compare_pqc_test.dart passes
  • dart test -P wasm test/mlkem_test.dart passes

No CHANGELOG entry: the repo has no unreleased section, so the version heading is left to the maintainer.


Generated by Claude Code

@dipu-bd
dipu-bd merged commit 212f258 into main Nov 28, 2026
17 checks passed
@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@dipu-bd
dipu-bd deleted the ccr-3e9bf447-zsxg7p branch November 28, 2026 20:28
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.

2 participants