Crate evp_bytestokey

source ·
Expand description

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
    // ...
}

Functions

  • Generates a key and initialization vector (IV) from a password using the EVP_BytesToKey algorithm.