- chr: documentation ( source)
- str_repeat: documentation ( source)
- rawurlencode: documentation ( source)
<?php
$str = 1;
$block = mcrypt_get_block_size('des', 'ecb');
$pad = $block - (strlen($str) % $block);
$str .= str_repeat(chr($pad), $pad);
echo rawurlencode(mcrypt_encrypt(MCRYPT_DES, 'd9daa', $str, MCRYPT_MODE_ECB));