diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2019-04-19 16:43:05 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2019-04-19 16:52:10 +0300 |
commit | 6a1b2622bda31c9eadf91d3c136207528cdd4635 (patch) | |
tree | 958635a666b700f077b066e8c718f35a030958c9 /coding | |
parent | 01ed2046098a9c608e2949c9246204990226a5c6 (diff) |
[booking] additional url params + ios statistics fix
Diffstat (limited to 'coding')
-rw-r--r-- | coding/sha1.cpp | 12 | ||||
-rw-r--r-- | coding/sha1.hpp | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/coding/sha1.cpp b/coding/sha1.cpp index a6182d497d..b1c412eed0 100644 --- a/coding/sha1.cpp +++ b/coding/sha1.cpp @@ -70,6 +70,18 @@ SHA1::Hash SHA1::CalculateForString(std::string const & str) } // static +std::string SHA1::CalculateForStringFormatted(std::string const & str) +{ + auto const hashRaw = CalculateForString(str); + + std::ostringstream os; + for (auto const value : hashRaw) + os << std::hex << static_cast<int>(value); + + return os.str(); +} + +// static std::string SHA1::CalculateBase64ForString(std::string const & str) { auto const sha1 = CalculateForString(str); diff --git a/coding/sha1.hpp b/coding/sha1.hpp index e0ad4ad225..842eb95466 100644 --- a/coding/sha1.hpp +++ b/coding/sha1.hpp @@ -15,6 +15,8 @@ public: static std::string CalculateBase64(std::string const & filePath); static Hash CalculateForString(std::string const & str); + // String representation of 40-number hex digit. + static std::string CalculateForStringFormatted(std::string const & str); static std::string CalculateBase64ForString(std::string const & str); }; } // coding |