26 releases (8 breaking)
new 0.9.5 | Apr 16, 2024 |
---|---|
0.9.3 | Feb 17, 2024 |
0.8.6 | Dec 7, 2023 |
0.8.5 | Nov 29, 2023 |
0.4.1 | Nov 9, 2022 |
#293 in Cryptography
241 downloads per month
Used in 2 crates
50KB
784 lines
scryptenc-rs
scryptenc-rs (scryptenc
) is an implementation of the
scrypt encrypted data format.
The format is defined here.
Usage
Add this to your Cargo.toml
:
[dependencies]
scryptenc = "0.9.5"
Example
use scryptenc::Params;
let data = b"Hello, world!\n";
let passphrase = "passphrase";
// Encrypt `data` using `passphrase`.
let ciphertext = scryptenc::encrypt(data, passphrase);
assert_ne!(ciphertext, data);
// And extract the scrypt parameters from it.
let params = Params::new(&ciphertext).unwrap();
assert_eq!(params.log_n(), 17);
assert_eq!(params.n(), u64::pow(2, 17));
assert_eq!(params.r(), 8);
assert_eq!(params.p(), 1);
// And decrypt it back.
let plaintext = scryptenc::decrypt(ciphertext, passphrase).unwrap();
assert_eq!(plaintext, data);
Crate features
alloc
Enables features that require an allocator. This is enabled by default (implied
by std
).
std
Enables features that depend on the standard library. This is enabled by default.
serde
Enables serialization support for Params
.
no_std
support
This supports no_std
mode. Disables the default
feature to enable this.
Documentation
See the documentation for more details.
Minimum supported Rust version
The minimum supported Rust version (MSRV) of this library is v1.74.0.
Changelog
Please see CHANGELOG.adoc.
Contributing
Please see CONTRIBUTING.adoc.
License
Copyright © 2022–2024 Shun Sakai (see AUTHORS.adoc)
This library is distributed under the terms of either the Apache License 2.0 or the MIT License.
This project is compliant with version 3.0 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.
Dependencies
~1.2–1.7MB
~35K SLoC