reverseCharset constant

List<int> const reverseCharset

charseti -> i, indexed directly by ASCII code unit. -1 means "not a valid Bech32 character". Sized to 128 (charset is ASCII-only, max code unit 122 for 'z'), so any code unit >= 128 is rejected by a simple range check before ever touching this table.

Implementation

static const List<int> reverseCharset = [
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  15,
  -1,
  10,
  17,
  21,
  20,
  26,
  30,
  7,
  5,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  29,
  -1,
  24,
  13,
  25,
  9,
  8,
  23,
  -1,
  18,
  22,
  31,
  27,
  19,
  -1,
  1,
  0,
  3,
  16,
  11,
  28,
  12,
  14,
  6,
  4,
  2,
  -1,
  -1,
  -1,
  -1,
  -1,
];