bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] base64: Allow URL-safe base64 strings to be decoded


From: Wido den Hollander
Subject: [PATCH] base64: Allow URL-safe base64 strings to be decoded
Date: Wed, 4 Jul 2012 15:38:30 +0200

With URL-safe base64 the + and / are replaced by - and _

This way we can accept base64 strings which are URL-safe.

Signed-off-by: Wido den Hollander <address@hidden>
---
 lib/base64.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/base64.c b/lib/base64.c
index 194e9ca..be91495 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -215,7 +215,9 @@ base64_encode_alloc (const char *in, size_t inlen, char 
**out)
    : (_) == '8' ? 60                            \
    : (_) == '9' ? 61                            \
    : (_) == '+' ? 62                            \
+   : (_) == '-' ? 62                            \
    : (_) == '/' ? 63                            \
+   : (_) == '_' ? 63                            \
    : -1)
 
 static const signed char b64[0x100] = {
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]