[#EVP_BytesToKey] = EVP_BytesToKey :mrdocs: Derive a cipher key and IV from a password using the legacy EVP_BytesToKey KDF. == Synopsis Declared in `<openssl/evp.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int EVP_BytesToKey( xref:EVP_CIPHER-07.adoc[EVP_CIPHER] const* type, xref:EVP_MD.adoc[EVP_MD] const* md, unsigned char const* salt, unsigned char const* data, int datal, int count, unsigned char* key, unsigned char* iv); ---- == Return Value Length of the derived key in bytes, or 0 on error. == Parameters [cols="1,4"] |=== | Name| Description | *type* | Cipher whose key and IV lengths determine the output sizes. | *md* | Digest used in the iterative key derivation (commonly EVP_md5()). | *salt* | Optional 8‐byte salt, or NULL. | *data* | Password / passphrase bytes. | *datal* | Length of `data` in bytes. | *count* | Iteration count (higher slows brute‐force attacks). | *key* | Output buffer for the derived key, or NULL to skip. | *iv* | Output buffer for the derived IV, or NULL to skip. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#