diff options
| author | Naios <naios-dev@live.de> | 2016-04-17 19:30:13 +0200 |
|---|---|---|
| committer | Naios <naios-dev@live.de> | 2016-04-17 19:30:13 +0200 |
| commit | 3271f328de35f940f682a0dbe1d9466e29190182 (patch) | |
| tree | b7e1d225ae06ba7236c994a80cd5ae10ad6b4fe9 /src/common/Cryptography/SHA1.cpp | |
| parent | 11b5de63cb7c5acd2f9385a4453b8ac76dec310e (diff) | |
Core/Cryptography: Move the SHA1 calculate helper to the SHA1 header
Diffstat (limited to 'src/common/Cryptography/SHA1.cpp')
| -rw-r--r-- | src/common/Cryptography/SHA1.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/Cryptography/SHA1.cpp b/src/common/Cryptography/SHA1.cpp index a01bd7844ee..aed4a069827 100644 --- a/src/common/Cryptography/SHA1.cpp +++ b/src/common/Cryptography/SHA1.cpp @@ -18,6 +18,7 @@ #include "SHA1.h" #include "BigNumber.h" +#include "Util.h" #include <cstring> #include <stdarg.h> @@ -67,3 +68,10 @@ void SHA1Hash::Finalize(void) SHA1_Final(mDigest, &mC); } +std::string CalculateSHA1Hash(std::string const& content) +{ + unsigned char digest[SHA_DIGEST_LENGTH]; + SHA1((unsigned char*)content.c_str(), content.length(), (unsigned char*)&digest); + + return ByteArrayToHexStr(digest, SHA_DIGEST_LENGTH); +} |
