Skip to content

4.0.0 - Rust under the hood

Choose a tag to compare

@Paol0B Paol0B released this 01 Jan 23:52
· 2 commits to main since this release
Immutable release. Only release title and notes can be modified.
0f5145f

Added

Rust-Accelerated Cryptographic Core: Complete rewrite of hashing engine using RustCrypto's argon2 crate with C FFI bindings
    Seamless P/Invoke integration for secure marshaling of sensitive data
    Automatic native library compilation during Release builds via MSBuild and Cargo
    Cross-platform native binaries: Windows, Linux (x64), and macOS (x64/ARM64)
Performance Improvements: 2-3x faster hashing performance vs v3.5.0 through:
    Rust native compilation with LLVM optimizations
    Direct access to CPU features (AVX2, SSE) without managed overhead
    Zero-allocation critical paths in cryptographic loops
Full RFC 9106 Compliance: Support for all optional parameters:
    Secret/pepper key support via Secret property
    Associated data (context) support via AssociatedData property with transparent compression for large inputs
    All three Argon2 variants: Argon2d, Argon2i, Argon2id
    All versions: Argon2 1.0 (0x10) and 1.3 (0x13)

Changed

Internal Architecture: Replaced pure C# implementation with P/Invoke bindings to Rust FFI layer
    Core hashing operations now execute in native Rust code
    C# wrapper maintains idiomatic .NET API surface (no breaking changes to public API)
    Memory marshaling handled securely with automatic null-pointer validation
Build Process: Added Rust compilation stage to .NET build pipeline
    MSBuild target triggers cargo build --release for each supported RID
    Native artifacts automatically embedded in NuGet package
    No user-side Rust toolchain required; pre-compiled binaries included
Package Composition: Multi-RID support in single NuGet
    Automatic selection of correct native library based on target platform
    Transparent loading via P/Invoke DllImport

Performance

Default Configuration: ~8 ms (vs ~15 ms in v3.5.0) - 1.9x faster
Testing Parameters: ~28 μs (vs ~53 μs in v3.5.0) - 1.9x faster
High Security: ~28 ms (vs ~51 ms in v3.5.0) - 1.8x faster

Fixed

Native dependency issues resolved through embedded native libraries
Cross-platform compatibility ensured with multi-RID package structure
Associated data handling for inputs larger than 32 bytes via Blake2b-256 hashing

Security

Rust memory safety guarantees at cryptographic core eliminate entire classes of vulnerabilities
Secure pointer validation and bounds checking in FFI layer
All sensitive data (passwords, salts, secrets) handled through immutable parameters
Secure memory cleanup via CryptographicOperations.ZeroMemory() on C# side

Documentation

Updated README with Rust-accelerated architecture details
Added build process documentation
Included native library compatibility notes

Breaking Changes

None - Public API fully compatible with v3.5.0
Minimum .NET version unchanged: .NET 8.0+