給你兩個函數﹐自己測試一下就通過了﹗
Function f_encrypt(sInput:string):string;
Const
AllChar:string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ';
Var
sOutput :string;
iPin:byte;
begin
if sInput = '' Then
sOutput := ''
else
begin
// sInput := f_PadR(sInput,20,' ');
for iPin:=1 to Length(sInput) do
begin
sOutput := sOutput+Char(Ord(sInput[iPin]) + 128);
end;
end;
Result := sOutput;
end;
Function f_inencrypt(sInput:string):string;
Const
AllChar:string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ';
Var
sOutput :string;
iPin:byte;
begin
if sInput = '' Then
sOutput := ''
else
begin
// sInput := f_PadR(sInput,20,' ');
for iPin:=1 to Length(sInput) do
begin
sOutput := sOutput+Char(Ord(sInput[iPin]) + 128);
end;
end;
Result := Trim(sOutput);
end;
一個是加密﹐一個解密﹗