php mcrypt_加密到C/C++/MFC均衡
我有一个PHP脚本,为用c++/MFC编写的应用程序生成产品密钥。 产品密钥是发送给用户的电子邮件,用户将其复制并传递到我的应用程序中php mcrypt_加密到C/C++/MFC均衡,php,c++,mfc,encryption,cryptography,Php,C++,Mfc,Encryption,Cryptography,我有一个PHP脚本,为用c++/MFC编写的应用程序生成产品密钥。 产品密钥是发送给用户的电子邮件,用户将其复制并传递到我的应用程序中 function EncryptData( $data ) { $key = "abcdefghijklmnopqrstuvwxyz"; // This encrypt method is described here // http://ca3.php.net/mcrypt $val = $data ; $ky = $key ; $m
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; }
我正在寻找用C++/MFC对上述函数的输出进行解码的方法。实际上是一个C库我看了一下libmcrypt,有点过头了。我希望有更简单的。