cipherlib
0.7.2, released 4 months ago by bitanon.dev
Pure-Dart symmetric ciphers, authenticated encryption, and post-quantum key encapsulation.
What it does
Provides a pure-Dart cryptography library supporting modern stream ciphers, AES modes, authenticated encryption with Poly1305, and ML-KEM post-quantum key exchange. It features one-shot and streaming operations without requiring any native code or FFI bindings.
AI-written summary of version 0.7.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need symmetric encryption or post-quantum key encapsulation implemented purely in Dart.
- Your application targets platforms where native bindings or FFI are unavailable or undesirable.
- You require support for streaming encryption via StreamTransformers.
Skip it when
- You need hardware-accelerated side-channel-resistant implementations where pure-Dart table lookups are insufficient.
- You are using encryption algorithms not covered by the library's supported set.
Strengths
- Runs on every platform where Dart does with no native code or FFI dependencies.
- Supports authenticated encryption by default with constant-time tag checks.
- Includes post-quantum cryptographic primitives (ML-KEM).
Weaknesses
- Pure-Dart AES uses table lookups which are not guaranteed to run in constant time.
- Dart runtimes cannot guarantee constant-time execution for ML-KEM side-channel protection.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
not documented
import 'package:cipherlib/cipherlib.dart';
import 'package:cipherlib/codecs.dart';
import 'package:cipherlib/random.dart';
void main() {
final key = randomBytes(32);
final nonce = randomBytes(12);
final aad = toUtf8('order-id=INV-1001');
final plain = toUtf8('Ship 3 units to dock-7');
final aes = AES(key).gcm(nonce, aad: aad);
final sealed = aes.encrypt(plain);
final opened = aes.decrypt(sealed);
print('plain : ${fromUtf8(opened)}');
}Alternatives
Packages that do the same job and could replace cipherlib.
- pqcrypto
Pure Dart post-quantum cryptography package implementing ML-KEM, ML-DSA, and SLH-DSA.
80Compare - pqforge
Pure-Dart post-quantum cryptography for ML-KEM, ML-DSA, SLH-DSA, and HPKE.
71Compare - oqs
Dart FFI bindings for liboqs enabling post-quantum cryptography primitives like ML-KEM and ML-DSA.
61Compare - brotli
Pure Dart Brotli decoder
50Compare
Works with
Packages commonly used together with cipherlib: ones it builds on, ones built on it, and its own family.