(This articel has been cross-posted to 'Crypto++ mailing' and 'mcrypt forum')
Hello.

PHP-mcrypt on Centos 5.1 based and crypto++ library make little
different output like this.
Is it not a bug or not?

PHP : :0x3D(61).0x15(21).0x69(105).0xCD(205).0x57(87).0xD5(213).
0x00(0).0x00(0).0x00(0).
Crypto 5.5.2: 3d 19 a1 60 b3 7d 00 00 00 00 00 00 0

Which side was wrong? Who can handle this?
Here are two sources.

--1.php source--------------------------------------
<?php
$userkey2 = "1234567890123456"; //AES 용 16
$input = "Hello!";

$td = mcrypt_module_open('rijndael-128', '', 'cfb', ''); 
//$blockkey_iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td),

MCRYPT_RAND);
echo "[";
echo mcrypt_enc_get_iv_size($td);
echo "]
<br>AES:CFB:";
$blockkey_iv2 = "1234567890123456";
echo "[";
echo $blockkey_iv2;
echo "<br>";
$s = mcrypt_generic_init($td, $userkey2, $blockkey_iv2);
if( ($s < 0) || ($s === false))
die( "Really an error" );
$encrypted_data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
echo "[";
echo $encrypted_data;
echo "<br>";
echo "-".strlen($encrypted_data).":";

printf(&quot;0x%02X(%d).&quot;, ord(substr($encrypted_data, 0, 1)),

ord(substr($encrypted_data, 0, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 1, 1)),
ord(substr($encrypted_data, 1, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 2, 1)),
ord(substr($encrypted_data, 2, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 3, 1)),
ord(substr($encrypted_data, 3, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 4, 1)),
ord(substr($encrypted_data, 4, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 5, 1)),
ord(substr($encrypted_data, 5, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 6, 1)),
ord(substr($encrypted_data, 6, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 7, 1)),
ord(substr($encrypted_data, 7, 1)));
printf("0x%02X(%d).", ord(substr($encrypted_data, 8, 1)),
ord(substr($encrypted_data, 8, 1)));

?>

--2.C++--------------------------------------
int keyLength = AES::DEFAULT_KEYLENGTH; // 16 bytes = 128 bit key
int defBlockSize = AES::BLOCKSIZE;

    // Generate a random key 
    long nTemp = AES::DEFAULT_KEYLENGTH; 
    byte key[AES::DEFAULT_KEYLENGTH + 2]; 
    memcpy(key, &quot;1234567890123456&quot;, 16); 
    strcpy((char *)key, &quot;1234567890123456&quot;);


    // Generate a random IV 
    byte iv[AES::BLOCKSIZE + 2]; 
    strcpy((char *)iv, &quot;1234567890123456&quot;);


    char plainText[1024] = &quot;Hello!&quot;; 
    byte ciphertext[1024]; 
    int messageLen = (int)strlen(plainText);


    ////////////////////////////////////////////////////////////////////////// 
    // Encrypt


    CFB_Mode&lt;AES&gt;::Encryption cfbEncryption(key, AES::DEFAULT_KEYLENGTH,

iv);
memset(ciphertext, 0x00, sizeof(ciphertext));
cfbEncryption.ProcessData((byte)ciphertext, (byte)plainText,
messageLen);

    ////////////////////////////////////////////////////////////////////////// 
    // Decrypt


    CFB_Mode&lt;AES&gt;::Decryption cfbDecryption(key, AES::DEFAULT_KEYLENGTH,

iv);
cfbDecryption.ProcessData((byte)plainText, (byte)ciphertext,
messageLen);