#checksum #nodejs #hash #openssl #create-decipher

evp_bytestokey

The insecure key derivation algorithm from OpenSSL

2 unstable releases

0.2.0 Feb 28, 2023
0.1.0 Feb 28, 2023

#1994 in Cryptography

Download history 5/week @ 2023-11-09 4/week @ 2023-11-16 4/week @ 2023-11-23 10/week @ 2023-11-30 2/week @ 2023-12-14 4/week @ 2023-12-21 2/week @ 2023-12-28 4/week @ 2024-01-25 4/week @ 2024-02-01 6/week @ 2024-02-08 30/week @ 2024-02-15 65/week @ 2024-02-22

107 downloads per month

MIT/Apache

6KB
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

~350KB