Salmon is an AES-256 CTR encryption library with built-in integrity, parallel operations, and seekable stream support. It provides a high level API for encrypting data, byte streams, and a virtual drive API for encrypted local and remote files. Optimized for Intel x86_64, ARM64, and GPU cards.
Access to the demo vault is remote and read-only so you won't be able to import new files.
Local drives are only available using Chrome.
Access to live web demo: Live Web Demo
Demo Vault files are licensed under Content License
Languages:
Java 11+
C# .NET 8+
Python 3.11+
Typescript ESM/ES2020
Javascript ESM/ES2020
C/C++ (data encryption API only, no streams)
Platforms Supported:
JavaFX 17+
.NET WPF
.NET Xamarin and MAUI
Android 23+ (No GPU-accel)
.NET Android 23+ (No GPU-accel)
Chrome (default JS crypto only)
Firefox, Safari (No Local drives / default JS crypto only)
Node.js (ESM modules / default JS crypto only)
Operating Systems Tested:
Windows 10+ x86_64
MacOS 10.11+ x86_64
Linux/Debian/Ubuntu x86_64, aarch64
Android 23+ ARM
CPU architectures:
Intel AES-NI SIMD x86_64
ARM SIMD aarch64
GPU Platforms:
OpenCL 1.2+
Benchmarks
How fast is Salmon?
jmh benchmark shows that salmon is almost 2x faster than OpenJDK 11 javax.crypto and 3x faster than Bouncy castle:
CPU: Intel i7 @2.00GHz
Data size: 32MB
Threads: 1
Benchmark Mode Cnt Score Error Units
SalmonBenchmark.EncryptAndDecryptSalmonNativeAesIntr thrpt 22.008 ops/s
SalmonBenchmark.EncryptAndDecryptSysBouncyCastle thrpt 6.457 ops/s
SalmonBenchmark.EncryptAndDecryptSysDefault thrpt 12.371 ops/s
C# benchmark shows that salmon is 2x faster than .NET 7 System.Security.Cryptography:
CPU: Intel i7 @2.00GHz
Data size: 32MB
Threads: 1
EncryptAndDecryptPerfSysDefault (System.Security.Cryptography)
Time ms:
enc: 682
dec: 548
Total: 1230
EncryptAndDecryptPerfSalmonNativeAesIntrinsics
Time ms:
enc time: 253
dec time: 253
Total: 506
In case you need more speed Salmon has baked-in multithreaded read/write operations, see API samples below.
// Simple encryption and decryption of byte array
byte[] key = Generator.getSecureRandomBytes(32); // Generate a secure key, keep this somewhere safe!
byte[] nonce = Generator.getSecureRandomBytes(8); // Generate a nonce, you must NOT reuse this again for encryption!
byte[] bytes = ..; // data you want to encrypt
Encryptor encryptor = new Encryptor(2); // use 2 threads to encrypt
byte[] encBytes = encryptor.encrypt(bytes, key, nonce, false);
encryptor.close();
Decryptor decryptor = new Decryptor(2); // use 2 threads to decrypt
byte[] decBytes = decryptor.decrypt(encBytes, key, nonce, false);
decryptor.close();
// Create a sequencer. Make sure this path is secure and excluded from your backups.
String sequencerPath = "c:\\users\\<username>\\AppData\\Local\\<somefolder>\\salmon_sequencer.xml";
FileSequencer sequencer = new FileSequencer(new File(sequencerPath), new SequenceSerializer());
// create() or open() a virtual drive provided with a location and a text password
// Supported drives: Drive, HttpDrive, WSDrive, NodeDrive (node.js)
AesDrive drive = Drive.create(new File("c:\\path\\to\\your\\virtual\\drive"), password, sequencer);
// you can now import files, create and list directories, for more info see the samples documentation
For complete samples for Java, C#, C, C++, Python, and JS:
Samples
For documentation:
Samples Documentation
For a showcase of the Salmon API visit:
Salmon Vault App
For a live web demo see:
Live Web Demo.
The API ref documentation is now almost complete:
Java/Android
| C#/.NET/Android
| C
| JavaScript
| TypeScript
| Python
User sequencer files keep information about the sequence ranges so they need to be kept in a protected space. Someone who has write access to a sequencer file and repeated read access to your encrypted files can leak encrypted information about your files. Also make sure that you never backup and restore the nonce sequencer files! You should always create them under a directory that is exluded from your backups, this will prevent nonce reuse!
More specifically for:
Importing files to a salmon virtual drive using different devices requires authorization by an already authorized device for each virtual drive. The device that created the drive is by default authorized. The authorization mechanism works by assigning new nonce ranges for each authorized device which prevents nonce reuse.
Salmon can inform if an encrypted file is tampered with. The verification works with HMAC-SHA256 only for file content ranges that are currently accessed so it allows fast random access without reading the whole file.
Salmon specs and subprojects: Salmon specifications and formats.
There are also plenty of README files under project folder on how to test build, and package.
To make things even easier there are scripts under the scripts folders to test, deploy, and generate docs:
Scripts.
To integrate Salmon into your project with Maven, Gradle, VS Studio, or VS Code:
Package Management
Unfortunately I cannot accept any code contributions.
Though, bugs and security reports are more than welcome!
If you have a request for a new features open an issue.
Salmon is released under MIT Licence, see LICENSE file.
Make sure you read the LICENSE file and display proper attribution if you decide to use this software.
Dependencies are covered by their own license see NOTICE