Jeff,

Decoding the plain text did the trick.  Thank you so much for your time and 
help.

Arthur

On Wednesday, February 3, 2016 at 4:16:56 PM UTC-7, Arthur Coleman wrote:
>
> I am attempting to reproduce AES test in the fipstest.cpp file.  The 
> cipher text I produce differs from the expect results.  The cipher does 
> decode correctly.  The cipher text I get is not only different but it is 
> also longer. I am working within MAC Xcode 7.1.1.  Here is my code.  
>
>     /**********************************************
>
>      *               ECB Mode
>
>      **********************************************/
>
>     const string ecb_128KeyStr = "2b7e151628aed2a6abf7158809cf4f3c";
>
>     // iv not used with AES::ECB_Mode
>
>     string ecb128Decode;
>
>     byte ecb128Key[AES::DEFAULT_KEYLENGTH];
>
>     CryptoPP::HexDecoder ecb128Decoder(new CryptoPP::StringSink
> (ecb128Decode));
>
>     ecb128Decoder.Put((byte*)ecb_128KeyStr.data(), ecb_128KeyStr.size());
>
>     ecb128Decoder.MessageEnd();
>
>     strncpy((char*)ecb128Key, ecb128Decode.c_str(), AES::DEFAULT_KEYLENGTH
> );
>
>     
>
>     string testVector1 = 
> "6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710"
> ;
>
>     string cipher = 
> "3ad77bb40d7a3660a89ecaf32466ef97f5d3d58503b9699de785895a96fdbaaf43b1cd7f598ece23881b00e3ed0306887b0c785e27e8ad3f8223207104725dd4"
> ;
>
>    
>
>     cout << cipher << endl << endl;
>
>     string ECBCipherText;
>
>     try {
>
>         CryptoPP::ECB_Mode< AES >::Encryption e;
>
>         e.SetKey(ecb128Key, sizeof(ecb128Key));
>
>         CryptoPP::StringSource(testVector1, true,
>
>                                new CryptoPP::StreamTransformationFilter(e,
>
>                                         new CryptoPP::StringSink
> (ECBCipherText)
>
>                                     )
>
>                                );
>
>         
>
>     } catch (const CryptoPP::Exception& e) {
>
>         cerr << e.what() << endl;
>
>         exit(1);
>
>     }
>
>     string encoded;
>
>     CryptoPP::StringSource(ECBCipherText, true,
>
>                     new CryptoPP::HexEncoder(
>
>                            new CryptoPP::StringSink(encoded),
>
>                                              false,
>
>                                              32
>
>                         ) // HexEncoder
>
>                ); // StringSource
>
>     cout << encoded << endl;
>
>     cout << "encoded == cipher is " << boolalpha << (encoded == cipher) 
> << ends;
>
>
> I am able to reproduce the correct results with the various SHA test. I am 
> a retired programmer working with the Crypto++ Library for a small project 
> I am writing for myself so this has low priority.
>
>
> Thank you for any help
>

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to