Module domain::utils::base64

source ·
Expand description

Decoding and encoding of Base 64.

The Base 64 encoding is defined in RFC 4648. There are two variants defined in the RFC, dubbed base64 and base64url which are differenciated by the last two characters in the alphabet. The DNS uses only the original base64 variant, so this is what is implemented by the module for now.

The module defines the type Decoder which keeps the state necessary for decoding. The various functions offered use such a decoder to decode and encode octets in various forms.


  • Serialize and deserialize octets Base64 encoded or binary.



  • An error happened while decoding a base 64 or base 32 encoded string.


  • Decodes a string with base64 encoded data.
  • Encodes binary data in base64 and writes it into a format stream.
  • Returns a placeholder value that implements Display for encoded data.
  • Encodes binary data in base64 and returns the encoded data as a string.