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

Function sha256hmac_hex

gpcontrib/gpcloud/src/s3utils.cpp:65–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65bool sha256hmac_hex(const char *str, char out_hash_hex[65], const char *secret, int secret_len) {
66 if (!str) return false;
67
68 unsigned char hash[SHA256_DIGEST_LENGTH]; // 32
69
70 sha256hmac(str, hash, secret, secret_len);
71
72 for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
73 sprintf(out_hash_hex + (i * 2), "%02x", hash[i]);
74 }
75 out_hash_hex[SHA256_DIGEST_STRING_LENGTH - 1] = 0;
76
77 return true;
78}
79
80/*
81 * It would be more efficient to use a variation of KMP to

Callers 2

TESTFunction · 0.85
SignRequestV4Function · 0.85

Calls 1

sha256hmacFunction · 0.85

Tested by 1

TESTFunction · 0.68