MCPcopy Create free account
hub / github.com/apache/cloudberry / sha1hmac_hex

Function sha1hmac_hex

gpcontrib/gpcloud/src/s3utils.cpp:21–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19}
20
21bool sha1hmac_hex(const char *str, char out_hash_hex[SHA_DIGEST_STRING_LENGTH], const char *secret,
22 int secret_len) {
23 if (!str) return false;
24
25 unsigned char hash[SHA_DIGEST_LENGTH];
26
27 sha1hmac(str, hash, secret, secret_len);
28
29 for (int i = 0; i < SHA_DIGEST_LENGTH; i++) {
30 sprintf(out_hash_hex + (i * 2), "%02x", hash[i]);
31 }
32 out_hash_hex[SHA_DIGEST_STRING_LENGTH - 1] = 0;
33
34 return true;
35}
36
37bool sha256_hex(const char *string, uint64_t length,
38 char out_hash_hex[SHA256_DIGEST_STRING_LENGTH]) {

Callers 1

TESTFunction · 0.85

Calls 1

sha1hmacFunction · 0.85

Tested by 1

TESTFunction · 0.68