diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-03-11 10:18:34 +0400 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-03-11 10:18:34 +0400 |
| commit | 075a3f6f4450967671d10b6d9e9388eb0d23b935 (patch) | |
| tree | e74ac921874b9f15cdbdce60f568b5965d83eab5 /CryptClass/HASHCrypt.cpp | |
| parent | 3b86f1c9108f7567905850080513391001e8eed1 (diff) | |
Clear branchstable
Diffstat (limited to 'CryptClass/HASHCrypt.cpp')
| -rw-r--r-- | CryptClass/HASHCrypt.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/CryptClass/HASHCrypt.cpp b/CryptClass/HASHCrypt.cpp deleted file mode 100644 index 4c42ef3..0000000 --- a/CryptClass/HASHCrypt.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file HASHCrypt.cpp - * @brief HASHCrypt class definitions - * @author manzerbredes - * @date 8 Mars 2015 - * - * Contain all definitions of HASHCrypt class. - * - */ - - -#include "HASHCrypt.hpp" - - -//Constructor -HASHCrypt::HASHCrypt(){ -} - -//Destructor -HASHCrypt::~HASHCrypt(){ -} - - - -void HASHCrypt::getMD5_128(std::string chain, byte* digest, int size){ - - //Digest size controller - this->checkDigestSize(CryptoPP::Weak1::MD5::DIGESTSIZE,size); - - //Create the MD5 on digest parameter - CryptoPP::Weak1::MD5 hash; - hash.CalculateDigest( digest, (byte*) chain.c_str(), chain.length() ); - -} - - -void HASHCrypt::getSHA_256(std::string chain, byte* digest, int size){ - - //Digest size controller - this->checkDigestSize(CryptoPP::SHA256::DIGESTSIZE,size); - - //Create the SHA-256 on digest parameter - CryptoPP::SHA256 hash; - hash.CalculateDigest( digest, (byte*) chain.c_str(), chain.length() ); -} - - - -void HASHCrypt::checkDigestSize(int sizeRequired, int size){ - try{ - if(size !=sizeRequired){ - throw this->getInvalidDigestSizeError(sizeRequired, size); - } - - } - catch(std::string erreur){ - std::cerr << erreur <<std::endl; - std::exit(EXIT_FAILURE); - } -} - - -std::string HASHCrypt::getInvalidDigestSizeError(int sizeRequired, int size){ - std::ostringstream erreurStream; - erreurStream << "Invalid digest size ! ("<< sizeRequired <<" bytes required and "<< size <<" given)"; - return erreurStream.str(); -} - |
