Decode base-32 method. I didn't want to add a dependency to Apache Codec just for this decode method. Exposed for
testing.
491795
static byte[] decodeBase32(String str) {
		// each base-32 character encodes 5 bits
		int numBytes = ((str.length() * 5) + 7) / 8;
		byte[] result = new byte[numBytes];
		int resultIndex = 0;
		int which = 0;
		int working = 0;
		for (int i = 0; i < str.length(); i++) {
			char ch = str.charAt(i);
			int val;
			if (ch >= 'a' && ch <= 'z') {
				val = ch - 'a';
			} else if (ch >= 'A' && ch <= 'Z') {
				val = ch - 'A';
			} else if (ch >= '2' && ch <= '7') {
				val = 26 + (ch - '2');
			} else if (ch == '=') {
				// special case
				which = 0;
				break;
			} else {
				throw new IllegalArgumentException("Invalid base-32 character: " + ch);
			}
			/*
			 * There are probably better ways to do this but this seemed the most straightforward.
			 */
			switch (which) {
				case 0:
					// all 5 bits is top 5 bits
					working = (val & 0x1F) << 3;
					which = 1;
					break;
				case 1:
					// top 3 bits is lower 3 bits
					working |= (val & 0x1C) >> 2;
					result[resultIndex++] = (byte) working;
					// lower 2 bits is upper 2 bits
					working = (val & 0x03) << 6;
					which = 2;
					break;
				case 2:
					// all 5 bits is mid 5 bits
					working |= (val & 0x1F) << 1;
					which = 3;
					break;
				case 3:
					// top 1 bit is lowest 1 bit
					working |= (val & 0x10) >> 4;
					result[resultIndex++] = (byte) working;
					// lower 4 bits is top 4 bits
					working = (val & 0x0F) << 4;
					which = 4;
					break;
				case 4:
					// top 4 bits is lowest 4 bits
					working |= (val & 0x1E) >> 1;
					result[resultIndex++] = (byte) working;
					// lower 1 bit is top 1 bit
					working = (val & 0x01) << 7;
					which = 5;
					break;
				case 5:
					// all 5 bits is mid 5 bits
					working |= (val & 0x1F) << 2;
					which = 6;
					break;
				case 6:
					// top 2 bits is lowest 2 bits
					working |= (val & 0x18) >> 3;
					result[resultIndex++] = (byte) working;
					// lower 3 bits of byte 6 is top 3 bits
					working = (val & 0x07) << 5;
					which = 7;
					break;
				case 7:
					// all 5 bits is lower 5 bits
					working |= (val & 0x1F);
					result[resultIndex++] = (byte) working;
					which = 0;
					break;
			}
		}
		if (which != 0) {
			result[resultIndex++] = (byte) working;
		}
		if (resultIndex != result.length) {
			result = Arrays.copyOf(result, resultIndex);
		}
		return result;
	}
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;
    }
560226
def _decode_signature(self, signature):
        

        sig = a2b_base64(signature)
        if len(sig) != 65:
            raise EncodingError("Wrong length, expected 65")

        # split into the parts.
        first = byte2int(sig)
        r = from_bytes_32(sig[1:33])
        s = from_bytes_32(sig[33:33+32])

        # first byte encodes a bits we need to know about the point used in signature
        if not (27 <= first < 35):
            raise EncodingError("First byte out of range")

        # NOTE: The first byte encodes the "recovery id", or "recid" which is a 3-bit values
        # which selects compressed/not-compressed and one of 4 possible public pairs.
        #
        first -= 27
        is_compressed = bool(first & 0x4)

        return is_compressed, (first & 0x3), r, s
856313
function decode(object) {
        if (defaults.decodeBase64 && object && object.content > '' &&
            object.encoding && object.encoding === 'base64') {
            object.content = b64decode(object.content)
        }
        return object
    }
941313
private static int decodeBase31(@Nonnull final String code) {
        int value = 0;
        for (final char c : code.toCharArray()) {
            if (c == '.') {
                return value;
            }
            if (DECODE_CHARS[c] < 0) {
                return -1;
            }
            value = (value * 31) + DECODE_CHARS[c];
        }
        return value;
    }
965341
public final byte[] decodeString(String base64String) {
        logger.entry();
        byte[] decodedBytes = Base64Utils.decode(base64String);
        logger.exit();
        return decodedBytes;
    }
1124371
public static byte[] decode(byte[] in) {
        return org.apache.commons.codec.binary.Base64.decodeBase64(in);
    }
1298329
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.chunksWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.chunkBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.totalBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        return bufferIndex - start;
    }
204200
public static long decodeBase32(String hash) {
        boolean isNegative = hash.startsWith("-");
        int startIndex = isNegative ? 1 : 0;
        long base = 1;
        long result = 0;
        for (int i = hash.length() - 1; i >= startIndex; i--) {
            int j = getCharIndex(hash.charAt(i));
            result = result + base * j;
            base = base * 32;
        }
        if (isNegative)
            result *= -1;
        return result;
    }
460447
static Base64VLQResult decode(String aStr, int aIndex) {
        int strLen = aStr.length();
        int result = 0;
        int shift = 0;
        boolean continuation;
        int digit;

        do {
            if (aIndex >= strLen) {
                throw new Error("Expected more digits in base 64 VLQ value.");
            }

            digit = Base64.decode(aStr.charAt(aIndex++));
            if (digit == -1) {
                throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
            }

            continuation = (digit & VLQ_CONTINUATION_BIT) != 0;
            digit &= VLQ_BASE_MASK;
            result = result + (digit << shift);
            shift += VLQ_BASE_SHIFT;
        } while (continuation);

        return new Base64VLQResult(fromVLQSigned(result), aIndex);
    }
733421
public static Integer decodeIntegerObjDesc(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int b = src[srcOffset];
            if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
                return null;
            }
            return decodeIntDesc(src, srcOffset + 1);
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
1251248
function decode (bufOrString) {
  if (Buffer.isBuffer(bufOrString)) {
    bufOrString = bufOrString.toString()
  }

  const code = bufOrString.substring(0, 1)
  bufOrString = bufOrString.substring(1, bufOrString.length)

  if (typeof bufOrString === 'string') {
    bufOrString = Buffer.from(bufOrString)
  }

  const base = getBase(code)
  return Buffer.from(base.decode(bufOrString.toString()))
}
1097262
public IDLProxyObject decode(byte[] bb) throws IOException {
        if (bb == null) {
            throw new IllegalArgumentException("param 'bb' is null");
        }
        Object object = codec.decode(bb);
        return new IDLProxyObject(codec, object, cls);

    }
746503
def _Decode(self, codec_name, data):
    """"""
    try:
      return data.decode(codec_name, "replace")
    except LookupError:
      raise RuntimeError("Codec could not be found.")
    except AssertionError:
      raise RuntimeError("Codec failed to decode")
1252901
private static String privateBase64Decoder(String decode, int flags) {
		if (flags == -1) {
			flags = Base64.DEFAULT;
		}

		byte[] data1 = Base64.decode(decode, flags);
		String decodedBase64 = null;
		try {
			decodedBase64 = new String(data1, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		return decodedBase64;
	}
1238364
def Decode(self, encoded_data):
    
    try:
      decoded_data = base64.b32decode(encoded_data, casefold=False)
    except (TypeError, binascii.Error) as exception:
      raise errors.BackEndError(
          'Unable to decode base32 stream with error: {0!s}.'.format(
              exception))

    return decoded_data, b''
1150266
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        this.indexNumber = SMBUtil.readInt8(buffer, bufferIndex);
        return 8;
    }