该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
private void DesCrypt(byte[] source, byte[] dest, byte[] key,int flg)
{
inti,h,j;
int t;
bytec1,c2;
byte[]buf new byte[8] ;
byte[] buf1 new byte[8];
byte[] destbuf new byte[9];
h 0 ;
/* 不满16位用FF填充 */
for( i0; i
if( source[i] ! 0)
h;
}
if(h<16){
for(ih;i<16;i)
source[i]F;
}
//source[16]0;
for (i0;i<16;ii2) {
/*字符转成十进制数字*/
if( is_digit( source[i] )){
c1 (byte)(source[i]-0) ;
}else if( is_xdigit(source[i] )){
c1 (byte)(source[i]-A10);
}else{
c1 source[i];
}
if( is_digit( source[i1] )){
c2 (byte)(source[i1]-0) ;
}else if( is_xdigit(source[i1] )){
c2 (byte)(source[i1]-A10);
}else{
c2 source[i1];
}
buf[i/2](byte)(c1*0x10c2);
/*密钥中的字符转换成十进制数字*/
if( is_digit(key[i])){
c1 (byte)(key[i]-0) ;
}else if(is_xdigit(key[i])){
c1 (byte)(key[i]-A10) ;
}else{
c1 key[i] ;
}
if( is_digit(key[i1])){
c2 (byte)(key[i1]-0) ;
}else if(is_xdigit(key[i1])){
c2 (byte)(key[i1]-A10) ;
}else{
c2 key[i1] ;
}
buf1[i/2](byte)(c1*0x10c2);
}
//Lke_des(buf,destbuf,buf1,flg);
destbuf encrypt(buf, buf1);
for(i0;i<8;i){
if((destbuf[i] F;
dest[i*21] F;
continue;
}
String str Integer.toHexString(destbuf[i]
//System.out.println("str:"str);
if(str.length() 1)
{
dest[i*20] (byte)("0".charAt(0));
dest[i*21] (byte)(str.charAt(0));
}
else
{
dest[i*20] (byte)(str.charAt(0));
dest[i*21] (byte)(str.charAt(1));
}
//System.out.println("destbuf:"destbuf);
//for(j0; j
//dest[i*2j] (byte)(str.toUpperCase().charAt(j));
//}
}
}