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.
``` rust use md5::{Md5, Digest};
fn main() { let password = "mysecretpassword"; let keybits = 256; let ivlen = 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
// ...
} ```