diff options
author | Kaz Kyheku <kaz@kylheku.com> | 2020-03-17 22:25:39 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-03-17 22:25:39 -0700 |
commit | ff36d718a997d24db9ac0e49042a99d5f5fad7a2 (patch) | |
tree | adf68df1fb899af6d2c3c3f91e54e3e33d7946c1 /txr.1 | |
parent | 592688572c0d0320dc9aabb931341d715bca141d (diff) | |
download | txr-ff36d718a997d24db9ac0e49042a99d5f5fad7a2.tar.gz txr-ff36d718a997d24db9ac0e49042a99d5f5fad7a2.tar.bz2 txr-ff36d718a997d24db9ac0e49042a99d5f5fad7a2.zip |
Support base64url encoding.
* filter.c (tobase64url_k, frombase64url_k): New keyword
symbols variables.
(base64_stream_enc_impl): New static function, derived from
base64_stream_enc.
(base64_stream_enc): Now a wrapper for base64_stream_enc_impl.
(base64url_stream_enc, base64url_encode): New functions.
(base64_stream_dec_impl): New static function, derived from
base64_stream_dec.
(base64-stream_dec): Now a wrapper for base64_stream_dec_impl.
(get_base64_url_char, b64url_code): New static functions.
(base64url_stream_dec, base64_url_decode,
base64url_decode_buf): New functions.
(filter_init): Intern new keyword symbols, initializing the
corresponding variables, register new :frombase64url
and :tobase64url filters and intrinsic functions
base64url-stream-enc, base64url-stream-dec, base64url-encode,
base64url-decode and base64url-decode-buf.
* filter.h (base64url_stream_enc, base64url_stream_dec,
base64url_encode, base64url_decode, base64url_decode_buf):
Declared.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 86 |
1 files changed, 84 insertions, 2 deletions
@@ -9454,10 +9454,27 @@ reserved set, encodes to .codn %2B . .coIP :frombase64 -Decode from the Base64 encoding described in RFC 4648. +Decode from the Base 64 encoding described in RFC 4648, section 5. .coIP :tobase64 -Encodes to the RFC 4648 Base64 encoding. +Encode to the Base 64 encoding described in RFC 4648, section 5. + +.coIP :frombase64url +Decode from the Base64 encoding described in RFC 4648, section 6. +This uses the URL and filename safe alphabet, in which the +.code + +(plus) and +.code / +(slash) characters used in regular Base 64 are respectively replaced with +.code - +(minus) and +.code _ +(underscore). + +.coIP :tobase64url +Encode to the Base 64 encoding described in RFC 4648, section 6. See +.code :frombase64url +above. .coIP :tonumber Converts strings to numbers. Strings that contain a period, @@ -62902,6 +62919,7 @@ function converts the UTF-8 representation of or the contents of .metn buf , to Base64 and returns that representation as a string. +The Base64 encoding is described in RFC 4648, section 5. The second argument must either be a character string, or a buffer object. @@ -62971,6 +62989,7 @@ The and .code base64-stream-dec perform, respectively, bulk Base64 encoding and decoding between streams. +This format is described in RFC 4648, section 5. The .meta in @@ -63040,6 +63059,69 @@ the .code base64-stream-dec function returns the number of bytes decoded. +.coNP Functions @, base64url-encode @ base64url-decode and @ base64url-decode-buf +.synb +.mets (base64url-encode >> [ string | << buf ] <> [ column-width ]) +.mets (base64url-decode < string) +.mets (base64url-decode-buf < string) +.syne +.desc +The +.codn base64url-encode , +.code base64url-decode +and +.code base64url-decode-buf +functions conform, in nearly every respect, to the descriptions of, +respectively, +.codn base64-encode , +.code base64-decode +and +.codn base64-decode-buf . +The difference is that these functions use the encoding described in +section 6 of RFC 4648, rather than section 5. This means that, in the +encoding alphabet, instead of the symbols +.code + +(plus) +and +.code / +(slash) +the symbols +.code - +(minus) +and +.code _ +(underline) are used. + +.coNP Functions @ base64url-stream-enc and @ base64url-stream-dec +.synb +.mets (base64url-stream-enc < out < in >> [ nbytes <> [ column-width ]]) +.mets (base64url-stream-dec < out << in ) +.syne +.desc +The +.code base64url-stream-enc +and +.code base64url-stream-dec +functions conform, in nearly every respect, to the descriptions of, +respectively, +.code base64-stream-enc +and +.codn base64-stream-dec . +The difference is that these functions use the encoding described in +section 6 of RFC 4648, rather than section 5. This means that, in the +encoding alphabet, instead of the symbols +.code + +(plus) +and +.code / +(slash) +the symbols +.code - +(minus) +and +.code _ +(underline) are used. + .SS* Filter Module The filter module provides a trie (pronounced "try") data structure, which is suitable for representing dictionaries for efficient filtering. |