Unify all the hex digits used in the app

This commit is contained in:
Alexandre Paillier
2022-06-07 14:44:01 +02:00
parent f99804de08
commit 10fbb8d5bc
6 changed files with 5 additions and 12 deletions

View File

@@ -24,13 +24,10 @@
#include "tokens.h"
#include "utils.h"
static const unsigned char hex_digits[] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
void array_hexstr(char *strbuf, const void *bin, unsigned int len) {
while (len--) {
*strbuf++ = hex_digits[((*((char *) bin)) >> 4) & 0xF];
*strbuf++ = hex_digits[(*((char *) bin)) & 0xF];
*strbuf++ = HEXDIGITS[((*((char *) bin)) >> 4) & 0xF];
*strbuf++ = HEXDIGITS[(*((char *) bin)) & 0xF];
bin = (const void *) ((unsigned int) bin + 1);
}
*strbuf = 0; // EOS