Hello
I have a PHP script that generates a product key for an application written in c++/MFC. The product key is email to the user and the user copy and pasts it in to my application.
function EncryptData( $data ) {
$key = "abcdefghijklmnopqrstuvwxyz";
// This encrypt method is described here
// http://ca3.php.net/mcrypt
$val = $data ;
$ky = $key ;
$mode = MCRYPT_MODE_ECB;
$enc = MCRYPT_RIJNDAEL_128;
$val = str_pad($val, (16*(floor(strlen($val) / 16)+(strlen($val) % 16==0?2:1))), chr(16-(strlen($val) % 16)));
$encript = mcrypt_encrypt($enc, $ky, $val, $mode, mcrypt_create_iv( mcrypt_get_iv_size($enc, $mode), MCRYPT_DEV_URANDOM));
$hex = bin2hex( $encript ) ;
$ret = strtoupper( $hex );
return $ret; }
I'm looking for a way to decoded the output of the above function in C++/MFC.