<?php
$plaintext = "\x04\x03\x02\x01\x00\x00\x00";
$ciphertext = mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,
"YELLOW SUBMARINE",
$plaintext,
MCRYPT_MODE_ECB
);
$decrypted = trim(
mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
"YELLOW SUBMARINE",
$ciphertext,
MCRYPT_MODE_ECB
)
);
var_dump([
bin2hex($plaintext),
bin2hex($decrypted)
]);
var_dump([
mb_strlen($plaintext, '8bit'),
mb_strlen($decrypted, '8bit')
]);
preferences:
23.89 ms | 407 KiB | 5 Q