if (aData == null || aData.length == 0) throw new IllegalArgumentException("Can not encode NULL or empty byte array."); byte encodedBuf[] = new byte[(aData.length + 2) / 3 * 4]; int srcIndex, destIndex; for (srcIndex = 0, destIndex = 0; srcIndex < aData.length - 2; srcIndex += 3) { encodedBuf[destIndex++] = mBase64EncMap[aData[srcIndex] >>> 2 & 077]; encodedBuf[destIndex++] = mBase64EncMap[aData[srcIndex + 1] >>> 4 & 017 | aData[srcIndex] << 4 & 077]; encodedBuf[destIndex++] = mBase64EncMap[aData[srcIndex + 2] >>> 6 & 003 ...
if ((aData == null) || (aData.length == 0)) throw new IllegalArgumentException("Can not encode NULL or empty byte array."); byte encodedBuf[] = new byte[((aData.length + 2) / 3) * 4]; int srcIndex, destIndex; for (srcIndex = 0, destIndex = 0; srcIndex < aData.length - 2; srcIndex += 3) { encodedBuf[destIndex++] = mBase64EncMap[(aData[srcIndex] >>> 2) & 077]; encodedBuf[destIndex++] = mBase64EncMap[(aData[srcIndex + 1] >>> 4) & 017 | (aData[srcIndex] << 4) & 077]; ...
int size = buf.length; char[] ar = new char[((size + 2) / 3) * 4]; int a = 0; int i = 0; while (i < size) { byte b0 = buf[i++]; byte b1 = (i < size) ? buf[i++] : 0; byte b2 = (i < size) ? buf[i++] : 0; ...
int srcLength = buf.length; byte[] input = new byte[3]; int[] output = new int[4]; StringBuffer out = new StringBuffer(); int i = 0; int chars = 0; while (srcLength > 2) { input[0] = buf[i++]; ...
int i = 0; int bytesToWrite = bytes.length; StringBuilder buff = new StringBuilder(bytes.length * 4 / 3); while (bytesToWrite >= 3) { buff.append(sCharLookup[(bytes[i] >>> 2) & 63]); buff.append(sCharLookup[((bytes[i] & 3) << 4) + ((bytes[i + 1] >>> 4) & 15)]); buff.append(sCharLookup[((bytes[i + 1] & 15) << 2) + ((bytes[i + 2] >>> 6) & 3)]); buff.append(sCharLookup[bytes[i + 2] & 63]); ...
if (bytes == null) { throw new IllegalArgumentException("Input bytes must not be null."); if (bytes.length >= BASE64_UPPER_BOUND) { throw new IllegalArgumentException("Input bytes length must not exceed " + BASE64_UPPER_BOUND); int triples = bytes.length / 3; if (bytes.length % 3 != 0) { ...
String hashString = Base64.getEncoder().encodeToString(bytes);
return hashString;
int current = 0; int state = 0; StringBuilder sb = new StringBuilder(); for (byte b : bytes) { switch (state) { case 0: sb.append(b64table[(b & 0b11111100) >>> 2]); current = (b & 0b00000011) << 4; ...
char[] tbl = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; StringBuilder buffer = new StringBuilder(); int pad = 0; for (int i = 0; i < data.length; i += 3) { int b = ((data[i] & 0xFF) << 16) & 0xFFFFFF; ...
StringBuilder sb = new StringBuilder(); int r = data.length % 3; int len = data.length - r; int i = 0; int c; while (i < len) { c = (0x000000ff & data[i++]) << 16 | (0x000000ff & data[i++]) << 8 | (0x000000ff & data[i++]); sb.append(base64EncodeChars[c >> 18]); ...