aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDenis Evsyukov <[email protected]>2020-02-22 10:29:00 +0300
committerDenis Evsyukov <[email protected]>2020-02-22 10:29:00 +0300
commit40cb3be8b7630971cdfb3d80de2d3598607f4193 (patch)
treebe9fafe775e260cb208414c9e2f5a21f89a24387 /src/main.cpp
parent[~] updates (diff)
downloadt-40cb3be8b7630971cdfb3d80de2d3598607f4193.tar.xz
t-40cb3be8b7630971cdfb3d80de2d3598607f4193.zip
[~] sha1 to sha256
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index c2c5b4f..c5ffd45 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,7 +2,7 @@
#include "functions.hpp"
#include "opts/cxxopts.hpp"
-#include "sha1/sha1.hpp"
+#include "sha256/picosha2.h"
using namespace std;
@@ -37,10 +37,13 @@ int main(int argc, char *argv[]) {
for (const auto &s : v) {
str += s + " ";
}
- str = trim(str);
- char hex[SHA1_HEX_SIZE];
- sha1(str.c_str()).finalize().print_hex(hex);
- cout << "sha1('" << str << "'): " << hex << endl;
+ auto src_str = trim(str);
+ std::vector<unsigned char> hash(picosha2::k_digest_size);
+ picosha2::hash256(src_str.begin(), src_str.end(), hash.begin(), hash.end());
+
+ std::string hex_str =
+ picosha2::bytes_to_hex_string(hash.begin(), hash.end());
+ cout << "sha256('" << str << "'): " << hex_str << endl;
}
std::string taskdir;
if (result.count("taskdir")) {