MCPcopy Create free account
hub / github.com/baidu/tera / GetHashString

Function GetHashString

src/utils/crypt.cc:12–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace tera {
11
12int32_t GetHashString(const std::string& str, uint32_t seed, std::string* result) {
13 if (result == NULL) {
14 return -1;
15 }
16 uint32_t hash = 0;
17 if (GetHashNumber(str, seed, &hash) != 0) {
18 return -1;
19 }
20 char hash_str[9];
21 sprintf(hash_str, "%08x", hash);
22
23 result->assign(hash_str, 8);
24 return 0;
25}
26
27int32_t GetHashNumber(const std::string& str, uint32_t seed, uint32_t* result) {
28 const char* data = str.c_str();

Callers 2

GetUserTokenMethod · 0.85
CalculateChecksumOfDataFunction · 0.85

Calls 1

GetHashNumberFunction · 0.85

Tested by

no test coverage detected