MCPcopy Create free account
hub / github.com/RischardV/emoji-shellcoding / hex2byte

Function hex2byte

block/block.cpp:33–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33static uint8_t hex2byte(char a, char b)
34{
35 uint8_t val = 0;
36 if (a != '\0') {
37 val += hex2byte('\0', a) << 4;
38 }
39 if ((b >= '0') && (b <= '9')) {
40 val += b - '0';
41 } else if ((b >= 'A') && (b <= 'F')) {
42 val += b - 'A' + 10;
43 } else if ((b >= 'a') && (b <= 'f')) {
44 val += b - 'a' + 10;
45 } else {
46 std::cerr << "Invalid char '" << b << "' in hex2byte" << std::endl;
47 exit(1);
48 }
49 return val;
50}
51
52static Bytes hex_to_bytes(const std::string &hex)
53{

Callers 1

hex_to_bytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected