PHP加密:带有256位密钥的AES-128-CBC? [关闭]

I am new to encryption and having some difficulty learning it, I would like to know what would happen if you used a 256bit key but AES-128-CBC as the encryption method?

I tried it and I know it works but I don't understand how or why? Does it change to AES-256? or does the key get truncated or does the length of the key not matter?

Key and encryption method are entirely two different things. No it does not change the encryption method if you change the key size.

Use PHP's "openssl_encrypt" function to encrypt using AES-256 (or any other method).

Here is very basic example of PHP AES-256 Encryption.

$text = 'Hey. Please Encrypt me';
$key = 'yHHEaF3Ht41wfcypJ2U5GES82Rpzl6yD';
$iv = openssl_random_pseudo_bytes(16);

$my_encrypted_string = openssl_encrypt($text, 'aes256', $key, iv);