Skip to content

Design Philosophy

Turkana Nation edited this page Jun 6, 2026 · 2 revisions

Design Philosophy

The architecture of pqcrypto is deliberately constrained. By reducing our dependency tree to zero and adhering strictly to FIPS specifications, we ensure maximum security and portability.

1. Zero Runtime Dependencies

Post-Quantum Cryptography is foundational. If a cryptographic library relies on dozens of external packages, any one of those packages becomes a supply chain vulnerability.

We explicitly vendor standard primitives (like FIPS 202 Keccak/SHA-3 and FIPS 180-4 SHA-2) directly into the src/common/ directory.

  • No ffi bindings to fragile C-libraries.
  • No relying on third-party hashing wrappers.
  • The only import required is the standard Dart SDK (dart:typed_data, dart:math).

2. Pure Dart for Total Portability

Because we do not use native bindings (dart:ffi), pqcrypto is inherently cross-platform. It runs perfectly on:

  • iOS & Android (via Flutter)
  • Windows, macOS, Linux (Dart VM)
  • Web Browsers (dart2js and dart2wasm)

3. Byte-Exact Compliance

We do not invent cryptography; we translate it. We treat the NIST Known Answer Tests (KATs) as absolute mathematical truth. Every algorithm in this library is tested against the thousands of official vectors generated by NIST. If a single byte in a 3,000-byte signature differs from the spec, the build fails.

4. Defensive Defaults

Cryptography APIs are notoriously easy to misuse. We design the public API to prevent footguns:

  • ML-DSA is hedged by default: Deterministic signatures are vulnerable to fault attacks. Our sign method injects fresh entropy (hedging) automatically, as recommended by FIPS 204.
  • Strict Validation: All keys and ciphertexts are validated for structural integrity and mathematical boundaries before they are processed.
  • Zeroization: Sensitive intermediate buffers in KEM and DSA are explicitly scrubbed in finally blocks to limit memory exposure.

Clone this wiki locally