*
Decodes the given base32-encoded string into an array of 5-bit integers.

@param {string} base32
186279
function decode(base32) {
  $.checkArgument(typeof base32 === 'string', 'Must be base32-encoded string');
  var data = [];
  for (var i=0; i<base32.length; i++) {
    var value = base32[i];
    $.checkArgument(value in CHARSET_INVERSE_INDEX, 'Non-base32, value '+ value);
    data.push(CHARSET_INVERSE_INDEX[value]);
  }
  return data;
}
1132413
private static int readCode(boolean[] rawbits, int startIndex, int length) {
    int res = 0;
    for (int i = startIndex; i < startIndex + length; i++) {
      res <<= 1;
      if (rawbits[i]) {
        res |= 0x01;
      }
    }
    return res;
  }
952433
def decode_ulid_base32(encoded):
    
    if len(encoded) != 26:
        raise InvalidULID('base32 ulid is %d characters long, expected 26' % len(encoded))

    if not all(c in _symbols for c in encoded):
        raise InvalidULID('invalid characters in base32 ulid')

    b = [ord(c) for c in encoded]

    if b[0] < 48 or b[0] > 55:
        # See https://github.com/oklog/ulid/issues/9:
        #   Technically, a 26-character Base32 encoded string can contain 130 bits of information,
        #   whereas a ULID must only contain 128 bits.
        #   Therefore, the largest valid ULID encoded in Base32 is 7ZZZZZZZZZZZZZZZZZZZZZZZZZ,
        #   which corresponds to an epoch time of 281474976710655 or 2 ^ 48 - 1.
        raise InvalidULID('base32 ulid is out of range (starts with %s; accepted are 01234567)' % encoded[0])

    tab = _decode_table
    binary = [(c & 0xFF) for c in [
        ((tab[b[0]] << 5) | tab[b[1]]),
        ((tab[b[2]] << 3) | (tab[b[3]] >> 2)),
        ((tab[b[3]] << 6) | (tab[b[4]] << 1) | (tab[b[5]] >> 4)),
        ((tab[b[5]] << 4) | (tab[b[6]] >> 1)),
        ((tab[b[6]] << 7) | (tab[b[7]] << 2) | (tab[b[8]] >> 3)),
        ((tab[b[8]] << 5) | tab[b[9]]),
        ((tab[b[10]] << 3) | (tab[b[11]] >> 2)),
        ((tab[b[11]] << 6) | (tab[b[12]] << 1) | (tab[b[13]] >> 4)),
        ((tab[b[13]] << 4) | (tab[b[14]] >> 1)),
        ((tab[b[14]] << 7) | (tab[b[15]] << 2) | (tab[b[16]] >> 3)),
        ((tab[b[16]] << 5) | tab[b[17]]),
        ((tab[b[18]] << 3) | tab[b[19]] >> 2),
        ((tab[b[19]] << 6) | (tab[b[20]] << 1) | (tab[b[21]] >> 4)),
        ((tab[b[21]] << 4) | (tab[b[22]] >> 1)),
        ((tab[b[22]] << 7) | (tab[b[23]] << 2) | (tab[b[24]] >> 3)),
        ((tab[b[24]] << 5) | tab[b[25]]),
    ]]
    return _to_binary(binary)
1018610
function decode(data) {

    var languageCodeLength = (data[0] & 0x3F), // 6 LSBs
        languageCode = data.slice(1, 1 + languageCodeLength),
        utf16 = (data[0] & 0x80) !== 0; // assuming UTF-16BE

    // TODO need to deal with UTF in the future
    // console.log("lang " + languageCode + (utf16 ? " utf16" : " utf8"));

    return util.bytesToString(data.slice(languageCodeLength + 1));
}
568951
public static function decode($base32)
    {
        $bytes = [];
        $base32Len = \strlen($base32);
        $base32LookupLen = \count(self::$base32Lookup);

        for ($i = $base32Len * 5 / 8 - 1; $i >= 0; --$i) {
            $bytes[] = 0;
        }

        for ($i = 0, $index = 0, $offset = 0; $i < $base32Len; $i++) {
            $lookup = \ord($base32[$i]) - \ord('0');

            /* Skip chars outside the lookup table */
            if ($lookup < 0 || $lookup >= $base32LookupLen) {
                continue;
            }

            $digit = self::$base32Lookup[$lookup];

            /* If this digit is not in the table, ignore it */
            if ($digit === 0xFF) {
                continue;
            }

            if ($index <= 3) {
                $index = ($index + 5) % 8;
                if ($index === 0) {
                    $bytes[$offset] |= $digit;
                    $offset++;
                    if ($offset >= \count($bytes)) {
                        break;
                    }
                } else {
                    $bytes[$offset] |= $digit << (8 - $index);
                }
            } else {
                $index = ($index + 5) % 8;
                $bytes[$offset] |= ($digit >> $index);
                $offset++;
                if ($offset >= \count($bytes)) {
                    break;
                }
                $bytes[$offset] |= $digit << (8 - $index);
            }
        }

        $bites = '';
        foreach ($bytes as $byte) {
            $bites .= \chr($byte);
        }

        return $bites;
    }
649748
function decode(buffer, encoding) {
		validateEncoding(encoding);
		if (encoding === null || encoding === 'buffer') return [buffer, new Buffer(0)];
		var decoder = new StringDecoder(encoding);
		var str = decoder.write(buffer);
		var leftover = decoder.charBuffer.slice(0, decoder.charReceived);
		return [str, leftover];
	}
814847
public byte []
getBase32String(base32 b32) throws IOException {
	String next = _getIdentifier("a base32 string");
	byte [] array = b32.fromString(next);
	if (array == null)
		throw exception("invalid base32 encoding");
	return array;
}
955523
function base64ToHex(str) {
        for (var i = 0, bin = atob(str.replace(/[ \r\n]+$/, "")), hex = []; i < bin.length; ++i) {
            var tmp = bin.charCodeAt(i).toString(16);
            if (tmp.length === 1) tmp = "0" + tmp;
            hex[hex.length] = tmp;
        }
        return hex.join(" ");
    }
126941
function decode(num, table, lengths) {
    /** @type {number} */
    var code;
    /** @type {number} */
    var prev;
    /** @type {number} */
    var repeat;
    /** @type {number} */
    var i;

    for (i = 0; i < num;) {
      code = this.readCodeByTable(table);
      switch (code) {
        case 16:
          repeat = 3 + this.readBits(2);
          while (repeat--) { lengths[i++] = prev; }
          break;
        case 17:
          repeat = 3 + this.readBits(3);
          while (repeat--) { lengths[i++] = 0; }
          prev = 0;
          break;
        case 18:
          repeat = 11 + this.readBits(7);
          while (repeat--) { lengths[i++] = 0; }
          prev = 0;
          break;
        default:
          lengths[i++] = code;
          prev = code;
          break;
      }
    }

    return lengths;
  }
317019
public static byte[] decode(char[] data) {

        int tempLen = data.length;
        for (int ix = 0; ix < data.length; ix++) {
            if ((data[ix] > 255) || codes[data[ix]] < 0) {
                --tempLen; // ignore non-valid chars and padding
            }
        }
        // calculate required length:
        // -- 3 bytes for every 4 valid base64 chars
        // -- plus 2 bytes if there are 3 extra base64 chars,
        // or plus 1 byte if there are 2 extra.

        int len = (tempLen / 4) * 3;
        if ((tempLen % 4) == 3) {
            len += 2;
        }
        if ((tempLen % 4) == 2) {
            len += 1;

        }
        byte[] out = new byte[len];

        int shift = 0; // # of excess bits stored in accum
        int accum = 0; // excess bits
        int index = 0;

        // we now go through the entire array (NOT using the 'tempLen' value)
        for (int ix = 0; ix < data.length; ix++) {
            int value = (data[ix] > 255) ? -1 : codes[data[ix]];

            if (value >= 0) { // skip over non-code
                accum <<= 6; // bits shift up by 6 each time thru
                shift += 6; // loop, with new bits being put in
                accum |= value; // at the bottom.
                if (shift >= 8) { // whenever there are 8 or more shifted in,
                    shift -= 8; // write them out (from the top, leaving any
                    out[index++] = // excess at the bottom for next iteration.
                            (byte) ((accum >> shift) & 0xff);
                }
            }
        }

        // if there is STILL something wrong we just have to throw up now!
        if (index != out.length) {
            throw new Error("Miscalculated data length (wrote " + index
                    + " instead of " + out.length + ")");
        }

        return out;
    }
148537
function decode(data) {
    var prefix = protocols[data[0]];
    if (!prefix) { // 36 to 255 should be ""
        prefix = "";
    }    
    return prefix + util.bytesToString(data.slice(1));      
}
52453
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        if ( this.largeFile ) {
            this.pid = SMBUtil.readInt2(buffer, bufferIndex);
            int boHigh = SMBUtil.readInt4(buffer, bufferIndex + 4);
            int boLow = SMBUtil.readInt4(buffer, bufferIndex + 8);

            this.byteOffset = ( boHigh << 32 ) | boLow;

            int lHigh = SMBUtil.readInt4(buffer, bufferIndex + 12);
            int lLow = SMBUtil.readInt4(buffer, bufferIndex + 16);

            this.lengthInBytes = ( lHigh << 32 ) | lLow;
            return 20;
        }
        this.pid = SMBUtil.readInt2(buffer, bufferIndex);
        this.byteOffset = SMBUtil.readInt4(buffer, bufferIndex + 2);
        this.lengthInBytes = SMBUtil.readInt4(buffer, bufferIndex + 6);
        return 10;
    }
342593
def base62_decode(string):
    

    alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

    base = len(alphabet)
    strlen = len(string)
    num = 0

    idx = 0
    for char in string:
        power = (strlen - (idx + 1))
        num += alphabet.index(char) * (base ** power)
        idx += 1

    return int(num)
807539
function decode3(s) {
  assert.equal(s.length, 3)
  const [ upper, mid, lower ] = s
  return (decode(upper) << 12) | (decode(mid) << 6) | decode(lower)
}
626610
function convertToBase64(input) {
        var result = "";
        var charCodes = getExpandedCharCodes(input);
        var i = 0;
        var length = charCodes.length;
        var byte1, byte2, byte3, byte4;
        while (i < length) {
            // Convert every 6-bits in the input 3 character points
            // into a base64 digit
            byte1 = charCodes[i] >> 2;
            byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
            byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
            byte4 = charCodes[i + 2] & 63;
            // We are out of characters in the input, set the extra
            // digits to 64 (padding character).
            if (i + 1 >= length) {
                byte3 = byte4 = 64;
            }
            else if (i + 2 >= length) {
                byte4 = 64;
            }
            // Write to the output
            result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
            i += 3;
        }
        return result;
    }
48162
function decode(buf) {
  let off = 0;
  var i;

  // unpack meta
  const meta = buf[(off += 1)];
  // const VERSION = meta >> 4;
  const argv = meta & 0xf;
  const args = new Array(argv);

  // unpack args
  for (i = 0; i < argv; i += 1) {
    const len = buf.readUInt32BE(off);
    off += 4;

    args[i] = buf.slice(off, (off += len));
  }

  return args;
}
480667
function decodeBase64(sEncoded) {

    // Input must be dividable with 4.
    if (!sEncoded || (sEncoded.length % 4) > 0) { return sEncoded; }
    else if (typeof (atob) != 'undefined') { return atob(sEncoded); }

    var nBits, i, sDecoded = '';
    var base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

    sEncoded = sEncoded.replace(/\W|=/g, '');
    for (i = 0; i < sEncoded.length; i += 4) {
        nBits =
            (base64.indexOf(sEncoded.charAt(i)) & 0xff) << 18 |
            (base64.indexOf(sEncoded.charAt(i + 1)) & 0xff) << 12 |
            (base64.indexOf(sEncoded.charAt(i + 2)) & 0xff) << 6 |
             base64.indexOf(sEncoded.charAt(i + 3)) & 0xff;
        sDecoded += String.fromCharCode(
            (nBits & 0xff0000) >> 16, (nBits & 0xff00) >> 8, nBits & 0xff);
    }
    return sDecoded.substring(0, sDecoded.length -
        ((sEncoded.charCodeAt(i - 2) == 61) ? 2 :
        (sEncoded.charCodeAt(i - 1) == 61 ? 1 : 0)));

}