2 unstable releases
0.2.0 | Feb 28, 2023 |
---|---|
0.1.0 | Feb 28, 2023 |
#663 in Cryptography
5KB
53 lines
Ported to Rust from EVP_BytesToKey
The insecure key derivation algorithm from OpenSSL.
WARNING: DO NOT USE, except for compatibility reasons.
MD5 is insecure.
Use at least scrypt
or pbkdf2-hmac-sha256
instead.
Example
use md5::{Md5, Digest};
fn main() {
let password = "mysecretpassword";
let key_bits = 256;
let iv_len = 16;
let (key, iv) = evp_bytes_to_key(password, key_bits, iv_len).unwrap();
// Use the key and IV to encrypt or decrypt your data as needed
// ...
}
lib.rs
:
Ported to Rust from EVP_BytesToKey
The insecure key derivation algorithm from OpenSSL.
WARNING: DO NOT USE, except for compatibility reasons.
MD5 is insecure.
Use at least scrypt
or pbkdf2-hmac-sha256
instead.
Example
use md5::{Md5, Digest};
fn main() {
let password = "mysecretpassword";
let key_bits = 256;
let iv_len = 16;
let (key, iv) = evp_bytes_to_key(password, key_bits, iv_len).unwrap();
// Use the key and IV to encrypt or decrypt your data as needed
// ...
}
Dependencies
~310KB