SHA-256: Difference between revisions
Content added Content deleted
(Added C++ implementation using cryptopp) |
|||
Line 269: | Line 269: | ||
return 0; |
return 0; |
||
}</lang> |
}</lang> |
||
=={{header|C++}}== |
|||
Uses [https://www.cryptopp.com/ crypto++]. Compile it with -lcryptopp |
|||
<lang cpp>#include <iostream> |
|||
#include <cryptopp/filters.h> |
|||
#include <cryptopp/hex.h> |
|||
#include <cryptopp/sha.h> |
|||
int main(int argc, char **argv){ |
|||
CryptoPP::SHA256 hash; |
|||
std::string digest; |
|||
std::string message = "Rosetta code"; |
|||
CryptoPP::StringSource s(message, true, |
|||
new CryptoPP::HashFilter(hash, |
|||
new CryptoPP::HexEncoder( |
|||
new CryptoPP::StringSink(digest)))); |
|||
std::cout << digest << std::endl; |
|||
return 0; |
|||
} |
|||
</lang> |
|||
=={{header|C sharp}}== |
=={{header|C sharp}}== |