请问如下代码是什么加密解密算法?(100分)

H

hongsen

Unregistered / Unconfirmed
GUEST, unregistred user!
const
C1 = 52845;
C2 = 22719;

function Encrypt(const S: String
Key: Word): String;
var
I: byte;
begin
//Result[0] := S[0];
setlength(result,length(s));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(Result) + Key) * C1 + C2;
end;
end;

function Decrypt(const S: String
Key: Word): String;
var
I: byte;
begin
//Result[0] := S[0];
setlength(result,length(s));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(S) + Key) * C1 + C2;
end;
end;
 
(A XOR B)XOR B=A而已;
Result:=c
是不好的习惯,有可能引起内存混乱。
 
谢谢DarwinZhang。不过能否解释一下:“Result:=c
是不好的习惯,有可能引起内存混乱。”?
 
你好!Encrypt和Decrypt中的参数Key是否就是所谓的密钥? 这个密钥的长度有何限
制(就本程序算法为例)?安全性如何?切盼回复!
 

Similar threads

顶部