页:
[1]
| fangyuxuan | 2004-4-7 02:29 PM |
|
求救大家啊 帮帮忙啊
这段类怎么用啊 怎么生成一张jsp网页啊
class keygan
{
public String GetKey(String rcode)
{
if(rcode.length()!=24)
return null;
byte[] temp=new byte[24];
rcode.getBytes(0,24,temp,0);
for(int i=0;i<24;i++)
temp[i]=Char2Code(temp[i]);
{
String str="5aa5-5a5a-a5a5-5a5a-a55a-00";
byte[] temp1=new byte[25];
str.getBytes (0,24,temp1,0);
for(int i=0;i<24;i++)
temp[i]^=temp1[i];
}
byte[] ch;
ch=Decode(temp[0],temp[1]);
temp[0]=ch[0];
temp[1]=ch[1];
ch=Decode(temp[2],temp[3]);
temp[2]=ch[0];
temp[3]=ch[1];
ch=Decode(temp[5],temp[6]);
temp[5]=ch[0];
temp[6]=ch[1];
ch=Decode(temp[7],temp[8]);
temp[7]=ch[0];
temp[8]=ch[1];
ch=Decode(temp[10],temp[11]);
temp[10]=ch[0];
temp[11]=ch[1];
ch=Decode(temp[12],temp[13]);
temp[12]=ch[0];
temp[13]=ch[1];
ch=Decode(temp[15],temp[16]);
temp[15]=ch[0];
temp[16]=ch[1];
ch=Decode(temp[17],temp[18]);
temp[17]=ch[0];
temp[18]=ch[1];
ch=Decode(temp[20],temp[21]);
temp[20]=ch[0];
temp[21]=ch[1];
ch=Decode(temp[22],temp[23]);
temp[22]=ch[0];
temp[23]=ch[1];
for(int i=0;i<24;i++)
temp[i]=Code2Char(temp[i]);
return new String(temp);
}
public byte Code2Char(byte ch)
{
if(ch<0||ch>=16)
return '-';
byte[] temp=new byte[25];
String code="0123456789ABCDEF000";
code.getBytes(0,16,temp,0);
return temp[(int)ch];
}
public byte Char2Code(byte ch)
{
byte[] temp=new byte[25];
String code="0123456789ABCDEF000";
code.getBytes(0,16,temp,0);
for(byte i=0;i<16;i++)
{
if(temp[i]==ch)
return i;
}
return 0;
}
public byte[] Decode(byte x,byte y)
{
byte z=(byte)((x<<4)&0xf0);
z+=(byte)(y&0x0f);
z=(byte)(z+38);
z=(byte)(z^56^85);
z-=38&0x0ff;
x=(byte)((z>>4) &0x0f);
y=(byte)(z&0x0f);
byte[] ch=new byte [2];
ch[0]=x;
ch[1]=y;
return ch;
}
} |
| kind.huang | 2004-4-8 01:13 AM |
|
| 最近眼睛痛,看不了了 |
| fangyuxuan | 2004-4-8 02:44 AM |
|
帮个忙啊 大哥大姐
帮忙做个jsp的注册用户 -发验证码到邮箱 |
| fangyuxuan | 2004-4-8 02:46 AM |
|
顶 求救
有现成的吗 发个给我也行 谢谢大家了 |
Powered by Discuz! Archiver 6.1.0
© 2001-2006 Comsenz Inc.
Processed in 0.006484 second(s), 2 queries |