# Function openssl::pkcs5::bytes_to_key [−] [src]

    pub fn bytes_to_key(
        cipher: Cipher,
        digest: MessageDigest,
        data: &[u8],
        salt: Option<&[u8]>,
        count: i32
    ) -> Result<KeyIvPair, ErrorStack>

Derives a key and an IV from various parameters.

If specified, `salt` must be 8 bytes in length.

If the total key and IV length is less than 16 bytes and MD5 is used then the algorithm is compatible with the key derivation algorithm from PKCS#5 v1.5 or PBKDF1 from PKCS#5 v2.0.

New applications should not use this and instead use `pbkdf2_hmac` or another more modern key derivation algorithm.