Module domain::utils::base32

source ·
Expand description

Decoding and encoding of base 32.

The base 32 encoding is defined in RFC 4648. It is essentially a case-insensitive version of base64 which is necessary when encoding binary data in domain names. The RFC defines two separate encodings, called base32 and base32hex. The DNS uses the latter version, particularly in NSEC3, for encoding binary data in domain names, because it has the property that the encoding maintains the order of the original data.

This module currently only implements base32hex but is prepared for adding the other option by using the prefix _hex wherever distinction is necessary.

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.

Re-exports

Structs

Functions

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