[][src]Module domain::utils::base32

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, as 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 convenince functions decode_hex and display_hex decode and encode octets using the base32hex encoding, respectively.

Decoding currently requires the bytes feature as it is intended for use by the master file parser. This will change when the parser will be converted to work with any octets builder.

Functions

display_hex

Encodes binary data in base32hex and writes it into a format stream.