8
8541051
Unregistered / Unconfirmed
GUEST, unregistred user!
我上次我在论坛里问了一个加解问题,得到一个加密的算法。本人基础太差没办法
根据那个算法写出解密过程。求高手帮帮忙!根据下面的加密代码写出解密的函数!
unit crypt;
interface
USES
Classes;
const
C1 = 52845;
C2 = 22719;
function Encrypt( S: String
Key: Word): String;
implementation
function Encrypt( S: String
Key: Word): String;
var
I: Integer;
j: Integer;
begin
Result := S;
for I := 1 to Length(S) do
begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(Result) + Key) * C1 + C2;
end;
s:=Result;
Result:='';
for i:=1 to length(s) do
begin
j:=Integer(s);
Result:=Result + Char(65+(j div 26))+Char(65+(j mod 26));
end;
end;
end.
根据那个算法写出解密过程。求高手帮帮忙!根据下面的加密代码写出解密的函数!
unit crypt;
interface
USES
Classes;
const
C1 = 52845;
C2 = 22719;
function Encrypt( S: String
Key: Word): String;
implementation
function Encrypt( S: String
Key: Word): String;
var
I: Integer;
j: Integer;
begin
Result := S;
for I := 1 to Length(S) do
begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(Result) + Key) * C1 + C2;
end;
s:=Result;
Result:='';
for i:=1 to length(s) do
begin
j:=Integer(s);
Result:=Result + Char(65+(j div 26))+Char(65+(j mod 26));
end;
end;
end.