View source code Display the source code in std/base64.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

Template std.base64.Base64Impl

Template for implementing Base64 encoding and decoding.

For most purposes, direct usage of this template is not necessary; instead, this module provides two default implementations: Base64 and Base64URL, that implement basic Base64 encoding and a variant intended for use in URLs and filenames, respectively.

Customized Base64 encoding schemes can be implemented by instantiating this template with the appropriate arguments. For example:

// Non-standard Base64 format for embedding in regular expressions.
alias Base64Re = Base64Impl!('!', '=', Base64.NoPadding);

Arguments

template Base64Impl(char Map62th, char Map63th, char Padding);

Functions

Function name Description
decode Decodes source into the given buffer.
decode Decodes source into a given output range.
decode Decodes source into newly-allocated buffer.
decodeLength Given a Base64 encoded string, calculates the length of the decoded string.
decoder Construct a Decoder that iterates over the decoding of the given Base64 encoded data.
encode Encode source into a char[] buffer using Base64 encoding.
encode Encodes source into an output range using Base64 encoding.
encode Encodes source to newly-allocated buffer.
encodeLength Calculates the length needed to store the encoded string corresponding to an input of the given length.
encoder Construct an Encoder that iterates over the Base64 encoding of the given input range.

Structs

Struct name Description
Decoder An input range that iterates over the decoded data of a range of Base64 encodings.
Decoder An input range that iterates over the bytes of data decoded from a Base64 encoded string.
Encoder An input range that iterates over the respective Base64 encodings of a range of data items.
Encoder An input range that iterates over the encoded bytes of the given source data.

NOTE

Encoded strings will not have any padding if the Padding parameter is set to NoPadding.

Authors

Masahiro Nakagawa, Daniel Murphy (Single value Encoder and Decoder)

License

Boost License 1.0.

Comments