A modern cryptography library. Work in progress, not ready for use yet.

Yawning Angel 3a16f0078f memory: Fix build with dmd 2.078.0 3 years ago
benchmarks bf0c5c62b4 X25519: Add a 64 bit optimized implementation. 4 years ago
source 3a16f0078f memory: Fix build with dmd 2.078.0 3 years ago
views 37eb4e6651 Poly1305: Use `trunc`/`zext` instead of `and` with a mask. 4 years ago
.editorconfig 0e94cea02a Add a editorconfig for dfmt, ignore some more files. 4 years ago
.gitignore 83ce0a9603 Add a simple benchmark. 4 years ago
README.md 313ab7bf47 docs: Update README.md. (No functional changes) 4 years ago
dub.json ad8379a522 Use exceptions instead of asserts in most locations. 4 years ago


deuterium - A modern cryptography library.

Yawning Angel (yawning at schwanenlied dot me)

A modern cryptography library for the D language, mostly written because I'm rage-quitting Go for my pet projects. This is being used primarily as an excuse to learn D well.

Supported Primitives:

  • Cryptographic pseudo-random number generation
    • ChaCha20 based CSPRNG backed by OS entropy
    • Raw OS entropy
  • ECC
    • X25519
  • Message Authentication Codes
    • Poly1305
    • SipHash-2-4
  • Stream ciphers
    • ChaCha20/XChaCha20

Planned Primitives:

  • Block ciphers
    • AES
  • ECC
    • Ed25519
    • (Maybe) X448
    • (Maybe) P-256
  • Hash functions
    • BLAKE2
    • SHA3/SHAKE
  • Stream ciphers
    • CTR-AES
  • AE
    • NaCl style boxes (Poly1305/XChaCha20)
  • AEAD
    • AEZv5
    • HS1-SIV
    • Poly1305ChaCha20
  • PQ Primitives
    • NewHope-Simple
    • SPHINCS-256


  • Most people will probably be happier calling OpenSSL or libsodium.
  • All primitives are written to be immune to timing side-channel attacks, though some utility functions are not.
  • Correct, maintainable, fast in decreasing order of importance.
  • Where possible, established implementations have been used as the basis of deuterium's implementations.
  • Performance tuning is centered around the assumption that LDC is used when building for performance, and that a modern 64 bit Intel system with at least SSSE3 is the target. In particular the library makes liberal use of LDC's capability to inline LLVM IR.
  • I do not have and therefore do not care about OSX or Windows.
  • A modest amount of effort will be made to avoid breaking API changes without a major version bump, however API stability while the the project is in the 0.0.x series is not guaranteed.