fromBase32 function

Uint8List fromBase32(
  1. String input, {
  2. Base32Codec? codec,
  3. bool padding = true,
})

Converts 5-bit Base-32 character sequence to 8-bit integer sequence.

Parameters:

  • input should be a valid base-32 encoded string.
  • If padding is true, the output will not have padding characters.
  • codec is the Base32Codec to use. It is derived from the other parameters if not provided.

Throws:

  • FormatException if the input contains invalid characters, and the length is not valid for a base-32 encoded string.

This implementation can handle both uppercase and lowercase alphabets. Any letters appearing after the first padding character is observed are ignored. If a partial string is detected, the following bits are assumed to be zeros.

Implementation

Uint8List fromBase32(
  String input, {
  Base32Codec? codec,
  bool padding = true,
}) {
  codec ??= _codecFromParameters(padding: padding);
  var out = codec.decoder.convert(input.codeUnits);
  return Uint8List.fromList(out);
}