On Wednesday, February 3, 2016 at 6:16:56 PM UTC-5, 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"
> ;
>
>    
>
>     ...
>
>
> 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
>

Run the key, the plain text and the cipher text through a hex decoder 
first. It looks like you are only doing it for the key. Also see HexDecoder 
on the Crypto++ wiki (http://www.cryptopp.com/wiki/HexDecoder).

The Crypto++ validation suite does the same thing 
(http://github.com/weidai11/cryptopp/blob/master/validat2.cpp). Notice the 
filter uses a HexDecoder as an attached transformation:

    FileSource fs(... "TestData/elgc1024.dat", true, new HexDecoder);

Also see "Release Process | Self Tests" on the Crypto++ wiki 
(http://www.cryptopp.com/wiki/Release_process#Self_Tests). It discusses how 
to validate the library.

Jeff

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
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 cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to