암호화 관련 소스 입니다.
아래와 같은데..... 도무지 어려운 말이 많아서...
아시는분 주석점 부탁드립니다......
Function EncryptionWithPassword(Str,Pwd: String; Encode: Boolean): String;
var
a,PwdChk,Direction,ShiftVal,PasswordDigit : Integer;
begin
PasswordDigit := 1;
PwdChk := 0;
for a := 1 to Length(Pwd) do Inc(PwdChk,Ord(Pwd[a]));
Result := Str;
if Encode then Direction := -1 else Direction := 1;
for a := 1 to Length(Result) do
begin
if Length(Pwd)=0 then
ShiftVal := a
else
ShiftVal := Ord(Pwd[PasswordDigit]);
if Odd(A) then
Result[A] := RotateBits(Result[A],-Direction*(ShiftVal+PwdChk))
else
Result[A] := RotateBits(Result[A],Direction*(ShiftVal+PwdChk));
inc(PasswordDigit);
if PasswordDigit > Length(Pwd) then PasswordDigit := 1;
end;
end;
Function RotateBits(C: Char; Bits: Integer): Char;
var
SI : Word;
begin
Bits := Bits mod 8;
if Bits < 0 then
begin
SI := MakeWord(Byte(C),0);
SI := SI shl Abs(Bits);
end
else
begin
SI := MakeWord(0,Byte(C));
SI := SI shr Abs(Bits);
end;
SI := Swap(SI);
SI := Lo(SI) or Hi(SI);
Result := Chr(SI);
end;