/Science.Cryptography.Ciphers

This project collects classic ciphers with high performance implementations.

Primary LanguageC#MIT LicenseMIT

Science.Cryptography.Ciphers v2 PREVIEW

NuGet CLI NuGet

A full featured toolkit for ancient and classic cipher methods, and their analysis tools, implemented in .NET using high performance memory management and SIMD hardware intrinsics.

Use command-line interface:

crypto encrypt shift -k 13 "Hello world!"
crypto solve "Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj."

Use rich framework APIs:

dotnet add package Science.Cryptography.Ciphers --prerelease
dotnet add package Science.Cryptography.Ciphers.Specialized --prerelease
dotnet add package Science.Cryptography.Ciphers.Analysis --prerelease

What's new in v2?

  • New CLI app for new way of usage
  • Ciphers and tools rewritten to allocation free operation, take advantage of hardware intrinsics, and use specialized fast path for ASCII encoding. See Performance Improvements for details and benchmarks.
  • Reworked analysis tools and IAsyncEnumerable interface for consuming analysis intermediate results
  • CryptogramSolver for automatic decryption of ciphertext
  • Brute force key spaces with parallel partitioning support
  • New ciphers (10+): Scytale, Morse Code with extended charset, Polybius, Columnar Transposition, Double Columnar Transposition, ADFGX, ADFGVX, Straddling Checkerboard, One-Time Pad, WolfenbĂĽtteler, Malespin
  • More detailed documentation

Command-line interface

Many of the library operations are published via CLI as well:

Framework APIs

You can unlock the full power of the library from code:

var cipher = new PlayfairCipher();
var key = PolybiusSquare.CreateFromKeyword("PLAYFAIR", WellKnownAlphabets.EnglishWithoutJ);
var ciphertext = cipher.Encrypt("Hello world!", key);

Assets

The full list of assets:

Contribution

Contributions for the following areas are welcome:

  • Ciphers
    • Prefer performance in implementation (no heap allocations, SIMD operations, ...)
    • Feel free to add any not listed
  • Performance improvements
    • Post benchmark and its results as evidence to show change in efficiency
  • Unit tests