MCPcopy Create free account
hub / github.com/KaisenAmin/c_std / encoding_base16_encode

Function encoding_base16_encode

encoding/encoding.c:1134–1152  ·  view source on GitHub ↗

* @brief Encodes binary data into Base16 (hexadecimal) format. * * This function encodes a given input string into Base16 format, also known as * hexadecimal encoding. Each byte of the input is represented by two hexadecimal * characters in the output string. * * @param input Pointer to the input binary data. * @param length Length of the input data. * * @return A dynamically allocated

Source from the content-addressed store, hash-verified

1132 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1133 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1134 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1135 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1136 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1137 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1138 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1139 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1140 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1141 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1142 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1143 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1144 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1145 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1146 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
1147 };
1148
1149 if (length % 2 != 0) {
1150 ENCODING_LOG("[encoding_base16_decode] Error: Invalid input length");
1151 return NULL;
1152 }
1153
1154 size_t olength = length / 2;
1155 char* decoded = (char*) malloc(olength + 1);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected