这点分啊? 唉,算了帮你一把吧结贴吧Function Encode(strCode : String) : String ; var i : Integer; P, AscP : String; begin i := 1; While i <= Length(strCode) do begin P := copy(strCode, i, 1); If i Mod 3 = 1 Then AscP := AscP + Chr(Ord(P[1])+3) Else If i Mod 3 = 2 Then AscP := AscP + Chr(ord(P[1]) + 5) Else AscP := AscP + Chr(ord(P[1]) + 1); i := i + 1; end; result := AscP; End ;Function Decode(strPass : String) : String; var i : Integer ; P, AscP : String ; begin i := 1; While i <= Length(strPass) do begin P := copy(strPass, i, 1); If i Mod 3 = 1 Then AscP := AscP + Chr((ord(P[1]) - 3)) Else If i Mod 3 = 2 Then AscP := AscP + Chr((ord(P[1]) - 5)) Else AscP := AscP + Chr((ord(P[1]) - 1)); i := i + 1 ; end; result := AscP;End ;
给你一个超简单的Function EncryptString( inStr:String; inKey:dword ):String var i:integer; begin Result:=''; for i:=0 to Length(inStr)-1 do Result[i]:=char(ord(inStr[i]) xor inKey)+i); end;
function EnCrypt(Source: String; Key: String = 'LW549'): String; //549@17:12 2003-10-23 var Current: Integer; KeyLength: Integer; begin if Key = '' then begin Result := Source; Exit; end; KeyLength := Length(Key); for Current := 1 to Length(Source) do begin Source[Current] := Char(Ord(Source[Current]) xor Ord(Key[(Current mod KeyLength) + 1])); Result := Result + IntToHex(StrToInt64(VarToStr(Ord(Source[Current]))), 2); end; SetLength(Result, Length(Source) * 2); end;function DeCrypt(Source: String; Key: String = 'LW549'): String; //549@17:12 2003-10-23 var Current: Integer; KeyLength: Integer; begin if Key = '' then begin Result := Source; Exit; end; KeyLength := Length(Key); SetLength(Result,Length(Source) div 2); for Current := 1 to (Length(Source) div 2) do begin Result[Current] := Char(HexToByte(Source[Current * 2 - 1]) * 16 + HexToByte(Source[Current * 2])); Result[Current] := Char(Ord(Result[Current]) xor Ord(Key[(Current mod KeyLength) + 1])); end; end; function HexToByte(const Hex: Char): Byte; //549@9:47 2004-7-26 const H: array[0..21] of Char = '0123456789abcdefABCDEF'; X: pointer = @H; asm PUSH ECX PUSH EDX MOV ECX, 21 MOV EDX, [X] @LoopBegin: CMP AL, byte PTR [EDX + ECX] JZ @Find LOOP @LoopBegin XOR AL,AL JMP @End@Find: CMP CL,15 JNG @NotGreaterThan15 SUB CL,6 @NotGreaterThan15: MOV AL, CL @End: POP EDX POP ECX end;
var
i : Integer;
P, AscP : String;
begin
i := 1;
While i <= Length(strCode) do
begin
P := copy(strCode, i, 1);
If i Mod 3 = 1 Then
AscP := AscP + Chr(Ord(P[1])+3)
Else If i Mod 3 = 2 Then
AscP := AscP + Chr(ord(P[1]) + 5)
Else
AscP := AscP + Chr(ord(P[1]) + 1);
i := i + 1;
end;
result := AscP;
End ;Function Decode(strPass : String) : String;
var
i : Integer ;
P, AscP : String ;
begin
i := 1;
While i <= Length(strPass) do
begin
P := copy(strPass, i, 1);
If i Mod 3 = 1 Then
AscP := AscP + Chr((ord(P[1]) - 3))
Else If i Mod 3 = 2 Then
AscP := AscP + Chr((ord(P[1]) - 5))
Else
AscP := AscP + Chr((ord(P[1]) - 1)); i := i + 1 ;
end;
result := AscP;End ;
var
i:integer;
begin
Result:='';
for i:=0 to Length(inStr)-1 do Result[i]:=char(ord(inStr[i]) xor inKey)+i);
end;
//549@17:12 2003-10-23
var
Current: Integer;
KeyLength: Integer;
begin
if Key = '' then begin
Result := Source;
Exit;
end;
KeyLength := Length(Key);
for Current := 1 to Length(Source) do begin
Source[Current] := Char(Ord(Source[Current]) xor
Ord(Key[(Current mod KeyLength) + 1]));
Result := Result + IntToHex(StrToInt64(VarToStr(Ord(Source[Current]))), 2);
end;
SetLength(Result, Length(Source) * 2);
end;function DeCrypt(Source: String; Key: String = 'LW549'): String;
//549@17:12 2003-10-23
var
Current: Integer;
KeyLength: Integer;
begin
if Key = '' then begin
Result := Source;
Exit;
end;
KeyLength := Length(Key);
SetLength(Result,Length(Source) div 2);
for Current := 1 to (Length(Source) div 2) do begin
Result[Current] := Char(HexToByte(Source[Current * 2 - 1]) * 16 +
HexToByte(Source[Current * 2]));
Result[Current] := Char(Ord(Result[Current]) xor
Ord(Key[(Current mod KeyLength) + 1])); end;
end;
function HexToByte(const Hex: Char): Byte;
//549@9:47 2004-7-26
const
H: array[0..21] of Char = '0123456789abcdefABCDEF';
X: pointer = @H;
asm
PUSH ECX
PUSH EDX MOV ECX, 21
MOV EDX, [X]
@LoopBegin:
CMP AL, byte PTR [EDX + ECX]
JZ @Find
LOOP @LoopBegin XOR AL,AL
JMP @End@Find:
CMP CL,15
JNG @NotGreaterThan15
SUB CL,6
@NotGreaterThan15:
MOV AL, CL
@End: POP EDX
POP ECX
end;
Delphibox.com有简单的例子下载的
http://lysoft.7u7.net