const MODS:tmods=('ke3wms','jnx9i8','dpqzl6','vyg1bh','7a4c2f','u5rto0');//不清楚这个是什么数据类型? SDOM:tmods=('wa6j1c','fblrk7','mg9q0s','vu3zth','po4xy2','ni5d8e'); DOMS:tmods=('mg9qwc','vu3zth','a6j10s','fbk7lr','5dpoy2','4xni8e');
function discryptpassword(apassword:string):string; var tmpi,i:integer; begin result:=lattertosixstr(apassword,sdom); if length(result)<3 then begin result:=''; exit; end; tmpi:=0; for i:=1 to 3 do tmpi:=tmpi*6+strtoint(result[i]); result:=copy(result,4,tmpi); result:=sixstrtolatter(result,mods); end;
function lattertosixstr(astr:string;amods:tmods):string; var i,n,p:integer;tmps1,tmps2:string; begin tmps1:=''; tmps2:=''; for i:=1 to length(astr) do begin for n:=1 to 6 do begin p:=pos(astr[i],amods[n]); if p>0 then begin tmps1:=tmps1+inttostr(n-1); tmps2:=inttostr(p-1)+tmps2; break; end; end; end; result:=tmps1+tmps2; end;
function sixstrtolatter(astr:string;amods:tmods):string; var i,n:integer; begin result:='';n:=length(astr); if (n mod 2)=1 then exit;//求余 for i:=1 to (n div 2) do //求商 begin result:=result+amods[ord(astr[i])-ord('0')+1][ord(astr[n-i+1])-ord('0')+1]; end; end;
|
请发表评论