X
xiaoxiami1
Unregistered / Unconfirmed
GUEST, unregistred user!
这是两个函数,比如90#无铅汽油,在edit控件加密和解密都没事,只要存到数据库再取出来解密就不对了!!!!!!!!!!!!!
function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(Result) + StartKey) * MultKey + AddKey;
end;
end;
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(InString) + StartKey) * MultKey + AddKey;
end;
end;
function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(Result) + StartKey) * MultKey + AddKey;
end;
end;
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(InString) + StartKey) * MultKey + AddKey;
end;
end;