DecodeBase32Hex (open)

Decodes an RFC 4648 base-32 hex encoded string.

Syntax

LOADLIB "wh::system.whlib";

STRING FUNCTION DecodeBase32Hex(STRING value)

Parameters

STRING value

String to decode

Return value

STRING

The decoded string, or an empty string when decoding failed because of an invalid character

Description

DecodeBase32Hex will decode a base-32 hex encoded string to its original value. Letters can be either uppercase or lowercase. The alphabet used is the one from RFC 4648 (table 4, chapter 7). The input value doesn't have to be fully padded (the trailing '=' characters are not required).

Examples

// returns "Hello, World"
STRING example1 := DecodeBase32Hex("91imor3f5gg5erridhi0");

// returns "123"
STRING example2 := DecodeBase32Hex("64P36===");

// returns "", this base32-encoded string cannot be base32hex-decoded
STRING example3 := DecodeBase32Hex("jbswy3dpfqqfo33snrsa");