H
hylly
Unregistered / Unconfirmed
GUEST, unregistred user!
{===============================================================================
功 能: 加/解密函数
参 数:
s string 要加/解密的字符串
Key Word 加/解密关键字
bEncrypt Boolean 加密 True 解密 False
返回值: 加/解密后的字符串 string
备 注:
SeedA 加/解密关键字
SeedB 加/解密关键字
SeedA = 5899;
SeedB = 5900;
Key = 444;
===============================================================================}
function Crypt(const s: string;
Key: Word;
const bEncrypt: Boolean = True): string;
var
i : Integer;
ps, pr: ^byte;
begin
SetLength(Result, Length(s));
ps := @s[1];
pr := @Result[1];
for i := 1 to length(s)do
begin
pr^ := ps^ xor (Key shr 8);
if bEncrypt then
Key := (pr^ + Key) * SeedA + SeedB
else
Key := (ps^ + Key) * SeedA + SeedB;
pr := pointer(integer(pr) + 1);
ps := pointer(integer(ps) + 1);
end
end;
功 能: 加/解密函数
参 数:
s string 要加/解密的字符串
Key Word 加/解密关键字
bEncrypt Boolean 加密 True 解密 False
返回值: 加/解密后的字符串 string
备 注:
SeedA 加/解密关键字
SeedB 加/解密关键字
SeedA = 5899;
SeedB = 5900;
Key = 444;
===============================================================================}
function Crypt(const s: string;
Key: Word;
const bEncrypt: Boolean = True): string;
var
i : Integer;
ps, pr: ^byte;
begin
SetLength(Result, Length(s));
ps := @s[1];
pr := @Result[1];
for i := 1 to length(s)do
begin
pr^ := ps^ xor (Key shr 8);
if bEncrypt then
Key := (pr^ + Key) * SeedA + SeedB
else
Key := (ps^ + Key) * SeedA + SeedB;
pr := pointer(integer(pr) + 1);
ps := pointer(integer(ps) + 1);
end
end;