Prolog-based base64 encoding using DCG rules. Encoding according to rfc2045. For example:
1 ?- base64('Hello World', X). X = 'SGVsbG8gV29ybGQ='. 2 ?- base64(H, 'SGVsbG8gV29ybGQ='). H = 'Hello World'.
The Base64URL encoding provides a URL and file name friendly alternative to base64. Base64URL encoded strings do not contain white space.
- base64_encoded(+Plain, -Encoded, +Options) is det
- base64_encoded(-Plain, +Encoded, +Options) is det
- General the base64 encoding and decoding. This predicate subsumes
base64/2 and base64url/2, providing control over padding, the
characters used for encoding and the output type. Options:
- Define the encoding character set to use. The (default)
classicuses the classical rfc2045 characters. The value
urluses URL and file name friendly characters. See base64url/2.
true(default), the output is padded with
- Defines the type of the output. One of
- base64(+Plain, -Encoded) is det
- base64(-Plain, +Encoded) is det
- Translates between plaintext and base64 encoded atom or string. See also base64//1.
- base64url(+Plain, -Encoded) is det
- base64url(-Plain, +Encoded) is det
- Translates between plaintext and base64url encoded atom or string. Base64URL encoded values can safely be used as URLs and file names. The use "-" instead of "+", "_" instead of "/" and do not use padding. This implies that the encoded value cannot be embedded inside a longer string.
- base64_encoded(+PlainText, +Options)// is det
- base64_encoded(-PlainText, +Options)// is det
- base64(+PlainText)// is det
- base64(-PlainText)// is det
- Encode/decode list of character codes using base64. See also base64/2.
- base64url(+PlainText)// is det
- base64url(-PlainText)// is det
- Encode/decode list of character codes using Base64URL. See also base64url/2.