- var_dump: documentation ( source)
- chr: documentation ( source)
- str_repeat: documentation ( source)
<?php
function aesEncrypt($str, $key) {
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, aesEncryptPad($str), MCRYPT_MODE_ECB);
}
function aesEncryptPad($str, $blockSize = 16) {
$len = $blockSize - (strlen($str) % $blockSize);
$padding = str_repeat(chr($len), $len);
return $str . $padding;
}
var_dump(aesEncrypt('ROLL TIDE', 'pass'));