return NULL;
}
+enum rspamd_base32_type
+rspamd_base32_decode_type_from_str (const gchar *str)
+{
+ enum rspamd_base32_type ret = RSPAMD_BASE32_INVALID;
+
+ if (str == NULL) {
+ return RSPAMD_BASE32_DEFAULT;
+ }
+
+ if (strcmp (str, "default") == 0 || strcmp (str, "zbase") == 0) {
+ ret = RSPAMD_BASE32_ZBASE;
+ }
+ else if (strcmp (str, "bleach") == 0) {
+ ret = RSPAMD_BASE32_BLEACH;
+ }
+ else if (strcmp (str, "rfc") == 0) {
+ ret = RSPAMD_BASE32_RFC;
+ }
+
+ return ret;
+}
+
static const guchar b32_dec_zbase[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
RSPAMD_BASE32_ZBASE = 0,
RSPAMD_BASE32_BLEACH,
RSPAMD_BASE32_RFC,
+ RSPAMD_BASE32_INVALID = -1,
};
+/**
+ * Returns base32 type from a string or RSPAMD_BASE32_INVALID
+ * @param str
+ * @return
+ */
+enum rspamd_base32_type rspamd_base32_decode_type_from_str (const gchar *str);
+
/**
* Encode string using base32 encoding
* @param in input