]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add rfc3548 base32 alphabet
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 9 Apr 2020 16:15:55 +0000 (17:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 9 Apr 2020 16:15:55 +0000 (17:15 +0100)
src/libutil/str_util.c
src/libutil/str_util.h

index 473e68782ef861b42616235781522e2c568e04b8..aaa3a0084dd1bb28643cd0def66e3eb8f492ec29 100644 (file)
@@ -543,7 +543,9 @@ rspamd_encode_base32_buf (const guchar *in, gsize inlen, gchar *out, gsize outle
                enum rspamd_base32_type type)
 {
        static const char b32_default[] = "ybndrfg8ejkmcpqxot1uwisza345h769",
-               b32_bleach[] = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", *b32;
+               b32_bleach[] = "qpzry9x8gf2tvdw0s3jn54khce6mua7l",
+               b32_rfc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
+               *b32;
        gchar *o, *end;
        gsize i;
        gint remain = -1, x;
@@ -558,6 +560,9 @@ rspamd_encode_base32_buf (const guchar *in, gsize inlen, gchar *out, gsize outle
        case RSPAMD_BASE32_BLEACH:
                b32 = b32_bleach;
                break;
+       case RSPAMD_BASE32_RFC:
+               b32 = b32_rfc;
+               break;
        default:
                g_assert_not_reached ();
                abort ();
index e7e5532c389a408163943e9538b2aa08149633fb..1d2a6684149a7af2fac7ae8079aeb35525838791 100644 (file)
@@ -161,7 +161,8 @@ guchar *rspamd_decode_hex (const gchar *in, gsize inlen);
 enum rspamd_base32_type {
        RSPAMD_BASE32_DEFAULT = 0,
        RSPAMD_BASE32_ZBASE = 0,
-       RSPAMD_BASE32_BLEACH
+       RSPAMD_BASE32_BLEACH,
+       RSPAMD_BASE32_RFC,
 };
 
 /**