Title: | Fast and URL-Safe Base64 Encoder and Decoder |
---|---|
Description: | In contrast to RFC3548, the 62nd character ("+") is replaced with "-", the 63rd character ("/") is replaced with "_". The resulting encoded strings comply to the regular expression pattern "[A-Za-z0-9_-]" and thus are safe to use in URLs or for file names. The package also comes with a simple base32 encoder/decoder suited for case insensitive file systems. |
Authors: | Michel Lang [cre, aut] , Apache Foundation [ctb, cph], Free Software Foundation [ctb, cph] |
Maintainer: | Michel Lang <[email protected]> |
License: | GPL-3 |
Version: | 1.4 |
Built: | 2024-11-09 03:22:01 UTC |
Source: | https://github.com/mllg/base64url |
Simple RFC4648 base32 encoder/decoder. Pads with “=”.
base32_encode(x, use.padding = FALSE) base32_decode(x, use.padding = FALSE)
base32_encode(x, use.padding = FALSE) base32_decode(x, use.padding = FALSE)
x |
[ |
use.padding |
[ |
[character
] of the same length as input x
.
Implementation based on base32 encoder/decoder in the GNU lib: https://www.gnu.org/software/gnulib/.
x = "plain text" encoded = base32_encode(x) decoded = base32_decode(encoded) print(encoded) print(decoded)
x = "plain text" encoded = base32_encode(x) decoded = base32_decode(encoded) print(encoded) print(decoded)
In contrast to RFC3548, the 62nd character (‘+’) is replaced with ‘-’, the 63rd character (‘/’) is replaced with ‘_’. Furthermore, the encoder does not fill the string with trailing ‘=’. The resulting encoded strings comply to the regular expression pattern “[A-Za-z0-9_-]” and thus are safe to use in URLs or for file names.
base64_urlencode(x) base64_urldecode(x)
base64_urlencode(x) base64_urldecode(x)
x |
[ |
[character
] of the same length as input x
.
Implementation based on base64 encoder/decoder in the Apache Portable Runtime (APR): https://svn.apache.org/repos/asf/apr/apr/trunk/encoding/apr_base64.c
x = "plain text" encoded = base64_urlencode(x) decoded = base64_urldecode(encoded) print(encoded) print(decoded)
x = "plain text" encoded = base64_urlencode(x) decoded = base64_urldecode(encoded) print(encoded) print(decoded)