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

Function sha256_hex

gpcontrib/gpcloud/src/s3utils.cpp:37–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37bool sha256_hex(const char *string, uint64_t length,
38 char out_hash_hex[SHA256_DIGEST_STRING_LENGTH]) {
39 if (!string) return false;
40
41 unsigned char hash[SHA256_DIGEST_LENGTH]; // 32
42
43 SHA256((unsigned char *)string, length, hash);
44
45 for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
46 sprintf(out_hash_hex + (i * 2), "%02x", hash[i]);
47 }
48 out_hash_hex[SHA256_DIGEST_STRING_LENGTH - 1] = 0;
49
50 return true;
51}
52
53bool sha256_hex(const char *string, char out_hash_hex[SHA256_DIGEST_STRING_LENGTH]) {
54 return sha256_hex(string, strlen(string), out_hash_hex);

Callers 5

TESTFunction · 0.85
uploadPartOfDataMethod · 0.85
completeMultiPartMethod · 0.85
SignRequestV4Function · 0.85
constructRandomStrMethod · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68