util: remove function to_hex (#22792)

old-commit-hash: ff33ca341382be19a4be9bd71b97af1b01b553c7
This commit is contained in:
Dean Lee
2021-11-04 23:18:01 +08:00
committed by GitHub
parent 72c892e014
commit 7ff2217c8b
4 changed files with 13 additions and 32 deletions
+1 -6
View File
@@ -9,7 +9,6 @@
#include <iostream>
#include <mutex>
#include <numeric>
#include <sstream>
#include "selfdrive/common/timing.h"
#include "selfdrive/common/util.h"
@@ -216,9 +215,5 @@ std::string sha256(const std::string &str) {
SHA256_Init(&sha256);
SHA256_Update(&sha256, str.c_str(), str.size());
SHA256_Final(hash, &sha256);
std::stringstream ss;
for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
ss << std::hex << std::setw(2) << std::setfill('0') << (int)hash[i];
}
return ss.str();
return util::hexdump(hash, SHA256_DIGEST_LENGTH);
}