R
R
rustem_ck2017-03-13 17:54:04
PHP
rustem_ck, 2017-03-13 17:54:04

Why can an AES-256 key be less than 32 characters long?

Rhetorical question

$pass = '1234';
        $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
        $result = openssl_encrypt('my_string', 'aes-256-cbc', $pass, 0, $iv);

Why f-iya correctly encodes with the password "1234", although there should be 32 characters?
mb_strlen('1234', '8bit')
//4

Is it mandatory to use a 32 character password?
UPD.
What if the password is longer than 32 characters?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2017-03-13
@Sanasol

because there is no limit on the length?
Just keep short = don't use encryption at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question