TRoyPass=class(TComponent)
private
aryA:ary;
aryB:ary;
aryC:ary;
Constructor Create(AOwner:TComponent);Override;
function A(paramString:String;var paramArrayOfString:ary):String;
function jdMethod_if(paramString:String;var paramArrayOfString:ary):String;
public
function Encrypt(paramString:string):string;
function Decrypt(paramString:string):string;
protected
str := '';
str := A(paramString, aryB);
i := 0;
for j := 1 to 3 do
i := i * 6 + StrToInt(MidBStr(str,j,1));
str := MidBStr(str,3+1, i);
Result := jdMethod_if(str, aryA);
end;
function TRoyPass.A(paramString:String;var paramArrayOfString:ary):String;
var
str1,str2 : String;
i,j,k : integer;
begin
str1 := '';
str2 := '';
for i:=0 to Length(paramString)-1 do
for j:=0 to 5 do
begin
k := Pos(MidBStr(paramString,i+1,1),paramArrayOfString[j]);
if (k>0) then
begin
str1 := str1 + IntToStr(j);
str2 := IntToStr(k-1) + str2;
break;
end;
end;
Result := str1 + str2;
end;
function TRoyPass.jdMethod_if(paramString:String;var paramArrayOfString:ary):String;
var
str1,str2,str3 : string;
i,j : Integer;
begin
str1 := '';
i := Length(paramString);
if (i mod 2 =1) then
Result :='';
for j := 0 to (i div 2)-1 do
begin
str2 := '';
str2 := paramArrayOfString[StrToInt(MidBStr(paramString,j+1,1))];
str3 := MidBStr(paramString,i - j ,1);
str1 := str1 + MidBStr(str2,StrToInt(str3)+1,1);
end;
Result:= str1;
end;
end.