scryptenc

Crates.ioscryptenc
lib.rsscryptenc
version0.9.7
sourcesrc
created_at2022-10-09 22:49:09.397329
updated_at2024-07-03 22:22:58.296245
descriptionAn implementation of the scrypt encrypted data format
homepagehttps://sorairolake.github.io/scryptenc-rs/
repositoryhttps://github.com/sorairolake/scryptenc-rs
max_upload_size
id684233
size78,215
Shun Sakai (sorairolake)

documentation

https://docs.rs/scryptenc

README

scryptenc-rs

CI Version MSRV Docs License

scryptenc-rs (scryptenc) is an implementation of the scrypt encrypted data format.

Usage

Add this to your Cargo.toml:

[dependencies]
scryptenc = "0.9.7"

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.

Commit count: 469

cargo fmt