isValid static method
Validates a Base32 string based on the encoding type. Returns true if the string is valid, false otherwise.
Implementation
static bool isValid(String b32str,
{Encoding encoding = Encoding.standardRFC4648}) {
var regex = EncodingUtils.getRegex(encoding);
// Only check even length for encodings that use padding
if (EncodingUtils.getPadded(encoding) && b32str.length % 2 != 0) {
return false;
}
if (!regex.hasMatch(b32str)) {
return false;
}
return true;
}