• Pierre Téchoueyres's avatar
    Add support for base64url variant of base-64 encoding/decoding · 7541b068
    Pierre Téchoueyres authored
    Implement the RFC4648 variant of base64 encoding used by URLs.
    * doc/lispref/text.texi (base64url-encode-region,
    base64url-encode-string): Document new functions.
    (base64-decode-region, base64-decode-string): Document new optional
    parameter 'base64url' used to use url variant when decoding data.
    * src/fns.c (base64url-encode-region, base64url-encode-region): New
    functions to manage url variant.
    (base64-decode-region, base64-decode-string): Add optional
    parameter to indicate use of url-variant.
    (base64_encode_region_1, base64_encode_string_1): Internal functions
    with extracted code from 'base64_encode_region' and
    'base64_encode_string' and optional parameters to manage padding and
    url variant.
    (base64-encode-region, base64-encode-string) : Use
    base64_encode_region_1 and base64_encode_string_1.
    (base64-encode-1): Add parameters to manage padding and url variant.
    (base64-decode-1): Add parameter to manage url variant.
    * test/src/fns-tests.el (fns-tests--with-region): New helper macro to
    test region variant of base64 encode / decode functions.
    (fns-tests--string-repeat): Helper function used in base64 tests.
    (fns-tests-base64-encode-region, fns-tests-base64-encode-string):
    Tests for standard base64 function.
    fns-test-base64url-encode-string): Tests for url variant.
    (fns-tests-base64-decode-string): Tests for decoding part.
fns.c 157 KB