MCPcopy Create free account
hub / github.com/apache/trafficserver / base16Encode

Function base16Encode

plugins/origin_server_auth/aws_auth_v4.cc:50–67  ·  view source on GitHub ↗

* @brief Lower-case Base16 encode a character string (hexadecimal format) * * @see AWS spec: http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html * Base16 RFC4648: https://tools.ietf.org/html/rfc4648#section-8 * * @param in ptr to an input counted string to be base16 encoded. * @param inLen input character string length * @return base16 encoded string. */

Source from the content-addressed store, hash-verified

48 * @return base16 encoded string.
49 */
50String
51base16Encode(const char *in, size_t inLen)
52{
53 if (nullptr == in || inLen == 0) {
54 return {};
55 }
56
57 std::stringstream result;
58
59 const char *src = in;
60 const char *srcEnd = in + inLen;
61
62 while (src < srcEnd) {
63 result << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>((*src) & 0xFF);
64 src++;
65 }
66 return result.str();
67}
68
69/**
70 * @brief URI-encode a character string (AWS specific version, see spec)

Callers 5

getPayloadSha256Function · 0.85
ValidateBenchFunction · 0.85

Calls 1

strMethod · 0.45

Tested by 1

ValidateBenchFunction · 0.68