MCPcopy Create free account
hub / github.com/cisco/libsrtp / octet_string_hex_string

Function octet_string_hex_string

test/util.c:255–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255char *octet_string_hex_string(const void *s, int length)
256{
257 const uint8_t *str = (const uint8_t *)s;
258 int i;
259
260 /* double length, since one octet takes two hex characters */
261 length *= 2;
262
263 /* truncate string if it would be too long */
264 if (length > MAX_PRINT_STRING_LEN) {
265 length = MAX_PRINT_STRING_LEN;
266 }
267
268 for (i = 0; i < length; i += 2) {
269 bit_string[i] = nibble_to_hex_char(*str >> 4);
270 bit_string[i + 1] = nibble_to_hex_char(*str++ & 0xF);
271 }
272 bit_string[i] = 0; /* null terminate string */
273 return bit_string;
274}
275
276static const char b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
277 "abcdefghijklmnopqrstuvwxyz0123456789+/";

Callers 15

test_hex_string_funcsFunction · 0.85
test_bswapFunction · 0.85
test_set_to_zeroFunction · 0.85
mainFunction · 0.85
sha1_test_case_validateFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
srtp_testFunction · 0.85
srtcp_testFunction · 0.85
srtp_packet_to_stringFunction · 0.85

Calls 1

nibble_to_hex_charFunction · 0.85

Tested by 6

test_hex_string_funcsFunction · 0.68
test_bswapFunction · 0.68
test_set_to_zeroFunction · 0.68
mainFunction · 0.68
sha1_test_case_validateFunction · 0.68