Crate scryptenc

source ·
Expand description

The scryptenc crate is an implementation of the scrypt encrypted data format.

The format is defined here.

Examples

use scrypt::Params;
use scryptenc::{Decryptor, Encryptor};

let password = "password";
let data = b"Hello, world!";

// Encrypt `data` using `password`.
let params = Params::new(10, 8, 1).unwrap();
let cipher = Encryptor::with_params(data, password, params);
let encrypted = cipher.encrypt_to_vec();

// And decrypt it back.
let cipher = Decryptor::new(encrypted, password).unwrap();
let decrypted = cipher.decrypt_to_vec().unwrap();
assert_eq!(decrypted, data);

Structs

Decryptor for the scrypt encrypted data format.
Encryptor for the scrypt encrypted data format.
The scrypt parameters.

Enums

The error type for the scrypt encrypted data format.