usually written by technical experts acting on their own initiative,
and are traditionally written in a pragmatic, experience-driven
manner.
-}2045 and also in RFC4648. This section describes the functions for
+}2045 and also in RFC 4648. This section describes the functions for
converting to and from this code.
@deffn Command base64-encode-region beg end &optional no-line-break
@end deffn
@deffn Command base64url-encode-region beg end &optional no-pad
-This function converts the region from @var{beg} to @var{end} into base
-64 code. It returns the length of the encoded text. An error is
-signaled if a character in the region is multibyte, i.e., in a
-multibyte buffer the region must contain only characters from the
-charsets @code{ascii}, @code{eight-bit-control} and
-@code{eight-bit-graphic}.
-
-Contrary to the function @code{base64-encode-region}, this function
-doesnt inserts newline characters into the encoded text, so the output
-is just one long line.
+This function is like @code{base64-encode-region}, but it implements
+the URL variant if base 64 encoding, per RFC 4648, and it doesn't
+inserts newline characters into the encoded text, so the output is
+just one long line.
-If the optional argument @var{no-pad} is non-@code{nil} then padding
-(@code{=}) isn't generated.
+If the optional argument @var{no-pad} is non-@code{nil} then this
+function doesn't generate the padding (@code{=}).
@end deffn
@defun base64-encode-string string &optional no-line-break
@end defun
@defun base64url-encode-string string &optional no-pad
-This function converts the string @var{string} into base 64 url code
-(see RFC4648). It returns a string containing the encoded text. As
-for @code{base64url-encode-region}, an error is signaled if a
-character in the string is multibyte.
+Like @code{base64-encode-string}, but generates the URL variant of
+base 64, and doesn't insert newline characters into the encoded text,
+so the result is just one long line.
-Contrary to @code{base64-encode-string}, this function doesnt inserts
-newline characters into the encoded text, so the result string is just
-one long line.
-
-If the optional argument @var{no-pad} is non-@code{nil} then padding
-(@code{=}) isn't generated.
+If the optional argument @var{no-pad} is non-@code{nil} then this
+function doesn't generate the padding.
@end defun
@deffn Command base64-decode-region beg end &optional base64url
The decoding functions ignore newline characters in the encoded text.
-If optional argument @var{base64url} is is non-@code{nil} then padding
-become optionnal and url variant is used (see RFC4648).
+If optional argument @var{base64url} is is non-@code{nil}, then padding
+is optional, and the URL variant of base 64 encoding is used.
@end deffn
@defun base64-decode-string string &optional base64url
The decoding functions ignore newline characters in the encoded text.
-If optional argument @var{base64url} is is non-@code{nil} then padding
-become optionnal and url variant is used (see RFC4648).
+
+If optional argument @var{base64url} is is non-@code{nil}, then padding
+is optional, and the URL variant of base 64 encoding is used.
@end defun
@node Checksum/Hash
Return the length of the encoded text.
Optional second argument NO-PAD means do not add padding char =.
-This is the variant defined in RFC4648. */)
+This produces the URL variant of base 64 encoding defined in RFC 4648. */)
(Lisp_Object beg, Lisp_Object end, Lisp_Object no_pad)
{
return base64_encode_region_1(beg, end, false, NILP(no_pad), true);
doc: /* Base64url-encode STRING and return the result.
Optional second argument NO-PAD means do not add padding char =.
-This is the variant defined in RFC4648. */)
+This produces the URL variant of base 64 encoding defined in RFC 4648. */)
(Lisp_Object string, Lisp_Object no_pad)
{
doc: /* Base64-decode the region between BEG and END.
Return the length of the decoded text.
If the region can't be decoded, signal an error and don't modify the buffer.
-Optional third argument BASE64URL define if base64Url variant will be used
-see RFC4648. */)
+Optional third argument BASE64URL determines whether to use the URL variant
+of the base 64 encoding, as defined in RFC 4648. */)
(Lisp_Object beg, Lisp_Object end, Lisp_Object base64url)
{
ptrdiff_t ibeg, iend, length, allength;
DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
1, 2, 0,
- doc: /* Base64-decode STRING and return the result
-Optional argument BASE64URL define if base64Url variant will be used
-see RFC4648. */)
+ doc: /* Base64-decode STRING and return the result as a string.
+Optional argument BASE64URL determines whether to use the URL variant of
+the base 64 encoding, as defined in RFC 4648. */)
(Lisp_Object string, Lisp_Object base64url)
{
char *decoded;
/* Process third byte of a quadruplet. */
if (!base64url)
- {
- READ_QUADRUPLET_BYTE (-1);
- }
+ READ_QUADRUPLET_BYTE (-1);
else
- {
- READ_QUADRUPLET_BYTE (e-to);
- }
+ READ_QUADRUPLET_BYTE (e-to);
if (c == '=')
{
/* Process fourth byte of a quadruplet. */
if (!base64url)
- {
- READ_QUADRUPLET_BYTE (-1);
- }
+ READ_QUADRUPLET_BYTE (-1);
else
- {
- READ_QUADRUPLET_BYTE (e-to);
- }
+ READ_QUADRUPLET_BYTE (e-to);
if (c == '=')
continue;