希望高手能给个加密算法
能给个算法吗,我等着做个Pubwin2007的会员转换程序,
可它的密码作了以下转换
000000EDDBx4IL
111111ETHAxoMK
222222EjLDxYAJ
123454 ETLCw4cP
123455 ETLCw4cO
123456 ETLCw4cN
1234567890 ETLCw4cNsuFccA==
654321 FjXFxIAK
000000EDDBx4IL
111111ETHAxoMK
222222EjLDxYAJ
123454 ETLCw4cP
123455 ETLCw4cO
123456 ETLCw4cN
1234567890 ETLCw4cNsuFccA==
9876543210GTjGwYcPtuv5mQ==
654321 FjXFxIAK
abcdefgQWKSk9dd4g==
abcdefgvwxyzQWKSk9dd4q/RGyYm
......Di7f2ZwV
******Cirb3ZgR
希望高手给段函数能将前面的明码转为后面的密码
[解决办法]
帮你反编译那Pubwin2007 JAVA版的BASE64变形源码了,请高手帮你看差别吧
// Decompiled Using: FrontEnd Plus v2.03 and the JAD Engine
// Available From: http://www.reflections.ath.cx
// Decompiler options: packimports(3)
// Source File Name: Base64.java
package com.hintsoft.dbmaintain.util;
public class Base64
{
public Base64()
{
}
private static int decode0(char ibuf[], byte obuf[], int wp)
{
int outlen = 3;
if(ibuf[3] == '= ')
outlen = 2;
if(ibuf[2] == '= ')
outlen = 1;
int b0 = S_DECODETABLE[ibuf[0]];
int b1 = S_DECODETABLE[ibuf[1]];
int b2 = S_DECODETABLE[ibuf[2]];
int b3 = S_DECODETABLE[ibuf[3]];
switch(outlen)
{
case 1: // '\001 '
obuf[wp] = (byte)(b0 < < 2 & 0xfc | b1 > > 4 & 3);
return 1;
case 2: // '\002 '
obuf[wp++] = (byte)(b0 < < 2 & 0xfc | b1 > > 4 & 3);
obuf[wp] = (byte)(b1 < < 4 & 0xf0 | b2 > > 2 & 0xf);
return 2;
case 3: // '\003 '
obuf[wp++] = (byte)(b0 < < 2 & 0xfc | b1 > > 4 & 3);
obuf[wp++] = (byte)(b1 < < 4 & 0xf0 | b2 > > 2 & 0xf);
obuf[wp] = (byte)(b2 < < 6 & 0xc0 | b3 & 0x3f);
return 3;
}
throw new RuntimeException( " ");
}
public static byte[] decode(char data[], int off, int len)
{
char ibuf[] = new char[4];
int ibufcount = 0;
byte obuf[] = new byte[(len / 4) * 3 + 3];
int obufcount = 0;
for(int i = off; i < off + len; i++)
{
char ch = data[i];
if(ch == '= ' || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != 127)
{
ibuf[ibufcount++] = ch;
if(ibufcount == ibuf.length)
{
ibufcount = 0;
obufcount += decode0(ibuf, obuf, obufcount);
}
}
}
if(obufcount == obuf.length)
{
return obuf;
} else
{
byte ret[] = new byte[obufcount];
System.arraycopy(obuf, 0, ret, 0, obufcount);
return ret;
}
}
public static byte[] decode(String data)
{
char ibuf[] = new char[4];
int ibufcount = 0;
byte obuf[] = new byte[(data.length() / 4) * 3 + 3];
int obufcount = 0;
for(int i = 0; i < data.length(); i++)
{
char ch = data.charAt(i);
if(ch == '= ' || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != 127)
{
ibuf[ibufcount++] = ch;
if(ibufcount == ibuf.length)
{
ibufcount = 0;
obufcount += decode0(ibuf, obuf, obufcount);
}
}
}
if(obufcount == obuf.length)
{
return obuf;
} else
{
byte ret[] = new byte[obufcount];
System.arraycopy(obuf, 0, ret, 0, obufcount);
return ret;
}
}
public static String encode(byte data[])
{
return encode(data, 0, data.length);
}
public static String encode(byte data[], int off, int len)
{
if(len <= 0)
return " ";
char out[] = new char[(len / 3) * 4 + 4];
int rindex = off;
int windex = 0;
int rest;
for(rest = len - off; rest > = 3; rest -= 3)
{
int i = ((data[rindex] & 0xff) < < 16) + ((data[rindex + 1] & 0xff) < < 8) + (data[rindex + 2] & 0xff);
out[windex++] = S_BASE64CHAR[i > > 18];
out[windex++] = S_BASE64CHAR[i > > 12 & 0x3f];
out[windex++] = S_BASE64CHAR[i > > 6 & 0x3f];
out[windex++] = S_BASE64CHAR[i & 0x3f];
rindex += 3;
}
if(rest == 1)
{
int i = data[rindex] & 0xff;
out[windex++] = S_BASE64CHAR[i > > 2];
out[windex++] = S_BASE64CHAR[i < < 4 & 0x3f];
out[windex++] = '= ';
out[windex++] = '= ';
} else
if(rest == 2)
{
int i = ((data[rindex] & 0xff) < < 8) + (data[rindex + 1] & 0xff);
out[windex++] = S_BASE64CHAR[i > > 10];
out[windex++] = S_BASE64CHAR[i > > 4 & 0x3f];
out[windex++] = S_BASE64CHAR[i < < 2 & 0x3f];
out[windex++] = '= ';
}
return new String(out, 0, windex);
}
private static final char S_BASE64CHAR[] = {
'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 ', '+ ', '/ '
};
private static final char S_BASE64PAD = 61;
private static final byte S_DECODETABLE[];
static
{
S_DECODETABLE = new byte[128];
for(int i = 0; i < S_DECODETABLE.length; i++)
S_DECODETABLE[i] = 127;
for(int i = 0; i < S_BASE64CHAR.length; i++)
S_DECODETABLE[S_BASE64CHAR[i]] = (byte)i;
}
}