Yes. i did.
Variable names modified atfer paste. that's why.
Here is new one.

Thanks.

------------new one -------------------------------
 char plainText[1024];
 byte ciphertext[1024];

 byte key[AES::DEFAULT_KEYLENGTH];
 memset(key, 0x00, sizeof(key));
 memcpy(key, "Key1234", 7); //9bytes NULL padded.

        int messageLen = (int)strlen(plainText);
        long nPadByte = 16 - (strlen(plainText) % 16);

        ECB_Mode<AES>::Encryption ecbEncryption(key, AES::DEFAULT_KEYLENGTH);
        memset(ciphertext, 0x00, sizeof(ciphertext));
        ecbEncryption.ProcessData((byte*)ciphertext, (byte*)plainText,
messageLen + nPadByte);

        
//////////////////////////////////////////////////////////////////////////
        // Decrypt
        //90 ba 06 74 05 4c 0f aa 48 5b 09 7c ea 88 58 3d
        unsigned char pPwd1[16] = {0x90,0xba,0x06,0x74,0x05,0x4c,0x0f,0xaa,
0x48,0x5b,0x09,0x7c,0xea,0x88,0x58,0x3d};
        ECB_Mode<AES>::Decryption ecbDecryption1(key,
AES::DEFAULT_KEYLENGTH);
        memset(plainText, 0x00, sizeof(plainText));
        memcpy(ciphertext, pPwd1, 16);
        ecbDecryption1.ProcessData((byte*)plainText, (byte*)ciphertext,
messageLen + nPadByte);

        unsigned char pPwd2[16] = {0x63,0x1C,0x25,0x25,0xEA,0x4E,0xD7,0x0F,
0x93,0x60,0x39,0xF9,0x4C,0x8B,0xF1,0x7A};
        ECB_Mode<AES>::Decryption ecbDecryption2(key,
AES::DEFAULT_KEYLENGTH);
        memset(plainText, 0x00, sizeof(plainText));
        memcpy(ciphertext, pPwd2, 16);
        ecbDecryption2.ProcessData((byte*)plainText, (byte*)ciphertext,
messageLen + nPadByte);



On 6월26일, 오전6시45분, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
> Hi Mitchell,
>
> > ECB_Mode<AES>::Decryption ecbDecryption(key, AES::DEFAULT_KEYLENGTH);
> > memset(plainText, 0x00, sizeof(plainText));
> > memcpy(ciphertext, pPwd1, 16);
> > ecbDecryption.ProcessData((byte*)plainText, (byte*)ciphertext, 16);
>
> > ECB_Mode<AES>::Decryption ecbDecryption(key, AES::DEFAULT_KEYLENGTH);
> > memset(plainText, 0x00, sizeof(plainText));
> > memcpy(ciphertext, pPwd2, 16);
> > ecbDecryption.ProcessData((byte*)plainText, (byte*)ciphertext, 16);
>
> Thi should have resulted in a compiler error since ecbDecryption is
> being declared twice within the same scope.
>
> Have you actually tried to run any code?
>
> Jeff
>
> On 6/25/08, Mitchell Lee (powerdev.org) <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Here is my new question. Who can answer this?
>
> > I have two different encrypted text.
> > But after decrypting this, i've got same result.
>
> > Is that right?
>
> > First one came from MySQL AES_ENCRYPTed blob field data.
> > Second one made by 'CryptoPP::Encryption' class.
> > Also mcrypt library make same result.
>
> > Here is test code.
> > ---------------------------------------------------------------------------­-----
> > char plainText[1024];
> > byte ciphertext[1024];
>
> > byte key[AES::DEFAULT_KEYLENGTH];
> > memset(key, 0x00, sizeof(key));
> > memcpy(key, "Key1234", 7); //9bytes NULL padded.
>
> > unsigned char pC1[16] = {0x90,0xba,0x06,0x74,0x05,0x4c,0x0f,0xaa,
> > 0x48,0x5b,0x09,0x7c,0xea,0x88,0x58,0x3d}
>
> > unsigned char pC2[16] = {0x63,0x1C,0x25,0x25,0xEA,0x4E,0xD7,0x0F,
> > 0x93,0x60,0x39,0xF9,0x4C,0x8B,0xF1,0x7A};
>
> > ECB_Mode<AES>::Decryption ecbDecryption(key, AES::DEFAULT_KEYLENGTH);
> > memset(plainText, 0x00, sizeof(plainText));
> > memcpy(ciphertext, pPwd1, 16);
> > ecbDecryption.ProcessData((byte*)plainText, (byte*)ciphertext, 16);
>
> > ECB_Mode<AES>::Decryption ecbDecryption(key, AES::DEFAULT_KEYLENGTH);
> > memset(plainText, 0x00, sizeof(plainText));
> > memcpy(ciphertext, pPwd2, 16);
> > ecbDecryption.ProcessData((byte*)plainText, (byte*)ciphertext, 16);- 따온 텍스트 
> > 숨기기 -
>
> - 따온 텍스트 보기 -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to