Crates.io | scryptenc |
lib.rs | scryptenc |
version | 0.9.7 |
source | src |
created_at | 2022-10-09 22:49:09.397329 |
updated_at | 2024-07-03 22:22:58.296245 |
description | An implementation of the scrypt encrypted data format |
homepage | https://sorairolake.github.io/scryptenc-rs/ |
repository | https://github.com/sorairolake/scryptenc-rs |
max_upload_size | |
id | 684233 |
size | 78,215 |
scryptenc-rs (scryptenc
) is an implementation of the
scrypt encrypted data format.
Add this to your Cargo.toml
:
[dependencies]
scryptenc = "0.9.7"
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);
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
supportThis supports no_std
mode. Disables the default
feature to enable this.
See the documentation for more details.
The minimum supported Rust version (MSRV) of this library is v1.74.0.
Please see CHANGELOG.adoc.
Please see CONTRIBUTING.adoc.
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.