]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix hex encoding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Feb 2016 17:43:15 +0000 (17:43 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Feb 2016 17:43:15 +0000 (17:43 +0000)
src/libutil/str_util.c

index 17039bd6c8f377b53eb60faaf9f93ea3bd56ef70..d488f0886dfb24e565cbdf2595f02a0b7d11a843 100644 (file)
@@ -1280,7 +1280,7 @@ rspamd_encode_hex (const guchar *in, gsize inlen)
        gchar *out, *o;
        const guchar *p;
        gsize outlen = inlen * 2 + 1;
-       static const gchar hexdigests[16] = "0123456789ABCDEF";
+       static const gchar hexdigests[16] = "0123456789abcdef";
 
        if (in == NULL) {
                return NULL;
@@ -1291,8 +1291,8 @@ rspamd_encode_hex (const guchar *in, gsize inlen)
        p = in;
 
        while (inlen > 0) {
-               *o++ = hexdigests[((*p >> 4) & 0xFF)];
-               *o++ = hexdigests[((*p++) & 0xFF)];
+               *o++ = hexdigests[((*p >> 4) & 0xF)];
+               *o++ = hexdigests[((*p++) & 0xF)];
                inlen --;
        }