- substr: documentation ( source)
- bin2hex: documentation ( source)
- http_build_query: documentation ( source)
<?php
$consumer_key = '15102ae1bd15946317d6bc2aa980f00e';
$private_key = '8aa6278625c27ad152fcb13db2cebbba';
$params = array(
'cost' => 5.00,
'cost_model' => 'cpi'
);
$mcrypt_iv = substr($consumer_key, 0, 16);
$query_str = http_build_query($params);
$enc_raw = mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $private_key, $query_str, 'cbc', $mcrypt_iv);
$enc_str = bin2hex( $enc_raw );
echo $enc_str ;