On Wednesday, April 6, 2016 at 12:55:17 AM UTC-4, Leighb2282 wrote:
>
> Hi Jeff,
>
> Thanks for taking the time to reply, unfortunately, the linked wiki 
> article seems to be incomplete (you would need to include hex.h for 
> HexEncoder or else you get g++ complaining about HexEncoder not being a 
> member of CryptoPP)
>
> Even after adding that header to the code it still gives a compile error 
> complaning that CryptoPP::MD5 has not been declared.
>
> As before here is the code I tried (pretty much a copy of the code from 
> that wiki + some slight additions (iostream, hex.h, stream)
>
> Many thanks again!
>
> ~Leigh
>
> #include <iostream>
> #include <string>
>
> #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
>
> #include <crypto++/md5.h>
> #include <crypto++/hex.h>
> int main()
> {
>
>     byte digest[ CryptoPP::MD5::DIGESTSIZE ];
>     std::string message = "foobarbat";
>
>     CryptoPP::Weak::MD5 hash;
>     hash.CalculateDigest( digest, (byte*) message.c_str(), 
> message.length() );
>     
>     CryptoPP::HexEncoder encoder;
>     std::string output;
>
>     encoder.Attach( new CryptoPP::StringSink( output ) );
>     encoder.Put( digest, sizeof(digest) );
>     encoder.MessageEnd();
>
>     return 0;
> }
>
> and I tried to compile it using this command
>
> g++ -std=c++11  -I/usr/local/include -lcrypto++ cpp-md5sum.cpp -o 
> cpp-md5sum
>
> getting the error:
>
> $ g++ -std=c++11  -I/usr/local/include -lcrypto++ cpp-md5sum.cpp -o 
> cpp-md5sum
> cpp-md5sum.cpp: In function ‘int main()’:
> cpp-md5sum.cpp:11:28: error: ‘CryptoPP::MD5’ has not been declared
>      byte digest[ CryptoPP::MD5::DIGESTSIZE ];
>                             ^
> cpp-md5sum.cpp:15:27: error: ‘digest’ was not declared in this scope
>      hash.CalculateDigest( digest, (byte*) message.c_str(), 
> message.length() );
>
>
Change this:

    CryptoPP::MD5::DIGESTSIZE

To this:

    CryptoPP::Weak::MD5::DIGESTSIZE

Jeff 

-- 
-- 
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