第一个粘出解码函数的人将得到价值几百美元的混淆工具,据评价也是目前最好的混淆器。当然,前题是你想要:)。
public class Base64Coder
{
public static void main(String[] args)
{
String a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";//这里不技持中文
String ru;
char[] ch;
try{
byte[] bt= a.getBytes("UTF-8");
ch = encrypt(bt);
//ru = new String(decrypt(ch));
System.out.println(ru);
}catch(Exception e){}
}
public static char[] encrypt(byte abyte0[])
{
int i = abyte0.length;
int j = (i * 4 + 2) / 3;
int k = ((i + 2) / 3) * 4;
char ac[] = new char[k];
int l = 0;
for(int i1 = 0; l < i; i1++)
{
int j1 = abyte0[l++] & 0xff;
int k1 = l >= i ? 0 : abyte0[l++] & 0xff;
int l1 = l >= i ? 0 : abyte0[l++] & 0xff;
int i2 = j1 >>> 2;
int j2 = (j1 & 3) << 4 | k1 >>> 4;
int k2 = (k1 & 0xf) << 2 | l1 >>> 6;
int l2 = l1 & 0x3f;
ac[i1++] = cChar[i2];
ac[i1++] = cChar[j2];
ac[i1] = i1 >= j ? '=' : cChar[k2];
i1++;
ac[i1] = i1 >= j ? '=' : cChar[l2];
}
return ac;
}
private static char cChar[];
private static byte bByte[];
static
{
cChar = new char[64];
int i = 0;
for(char c = 'A'; c <= 'Z'; c++)
cChar[i++] = c;
for(char c1 = 'a'; c1 <= 'z'; c1++)
cChar[i++] = c1;
for(char c2 = '0'; c2 <= '9'; c2++)
cChar[i++] = c2;
cChar[i++] = '+';
cChar[i++] = '/';
bByte = new byte[128];
for(int j = 0; j < bByte.length; j++)
bByte[j] = -1;
for(int k = 0; k < 64; k++)
bByte[cChar[k]] = (byte)k;
}
}