中
中国最猥琐的程序员
Unregistered / Unconfirmed
GUEST, unregistred user!
看下这个算法,并给出解密过程,谢谢!
function EnCode(Str:AnsiString):AnsiString;
var
i,len : integer;
b1,b2,Cur : Byte;
begin
len:=(StrLen(PChar(Str)) shr 1 ) + 1;
Result:='';
for i := 0 to Len do
Begin
b1 := byte(PChar(Str));
b2 := byte(PChar(Str)[i+1]);
b1 := b1 + 9;
b2 := b2 + 9;
b1 := b1 xor (i and 63);
b2 := (b2 xor (i and 63)) shr 2;
Cur := b1 xor b2;
Result:=Result+Char(Cur);
End;
End;
function EnCode(Str:AnsiString):AnsiString;
var
i,len : integer;
b1,b2,Cur : Byte;
begin
len:=(StrLen(PChar(Str)) shr 1 ) + 1;
Result:='';
for i := 0 to Len do
Begin
b1 := byte(PChar(Str));
b2 := byte(PChar(Str)[i+1]);
b1 := b1 + 9;
b2 := b2 + 9;
b1 := b1 xor (i and 63);
b2 := (b2 xor (i and 63)) shr 2;
Cur := b1 xor b2;
Result:=Result+Char(Cur);
End;
End;