1,183
社区成员
发帖
与我相关
我的任务
分享
......
var
Form1: TForm1;
implementation
const Secretkey='9762801435';
var wd_Encryption,jd_Encryption,
wd_Decrypt,jd_Decrypt:string;
{$R *.dfm}
function TForm1.Encryption(s: ansistring): ansistring;//加密
var i:integer;
begin
try
for i:=1 to length(s) do begin
if s[i]='.' then Result:=Result+'.'
else Result:=Result+ Secretkey[strtoint(s[i])+1];
end;
except
Result:='';
end;
end;
function TForm1.Decrypt(s: ansistring): ansistring;//解密
var i:integer;
begin
try
for i:=1 to length(s) do begin
if s[i]='.' then Result:=Result+'.'
else Result:=Result+ inttostr(pos(s[i],Secretkey)-1);
end;
except
Result:='';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);//获取加密后的坐标
begin
wd_Encryption:=Encryption(centerweidu.innerText);//经度
jd_Encryption:=Encryption(centerjingdu.innerText);//纬度
end;
procedure TForm1.Button2Click(Sender: TObject);//获取解密后的坐标
begin
wd_Decrypt:=Decrypt(wd_Encryption);//经度
jd_Decrypt:=Decrypt(jd_Encryption);//纬度
end;
......
......
var
Form1: TForm1;
implementation
const Secretkey='9762801435';
var wd_Encryption,jd_Encryption,
wd_Decrypt,jd_Decrypt:string;
{$R *.dfm}
function TForm1.Encryption(s: ansistring): ansistring;//加密
var i:integer;
begin
try
for i:=1 to length(s) do begin
if s[i]='.' then Result:=Result+'.'
else Result:=Result+ Secretkey[strtoint(s[i])];
end;
except
Result:='';
end;
end;
function TForm1.Decrypt(s: ansistring): ansistring;//解密
var i:integer;
begin
try
for i:=1 to length(s) do begin
if s[i]='.' then Result:=Result+'.'
else Result:=Result+ inttostr(pos(s[i],Secretkey));
end;
except
Result:='';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);//获取加密后的坐标
begin
wd_Encryption:=Encryption(centerweidu.innerText);//经度
jd_Encryption:=Encryption(centerjingdu.innerText);//维度
end;
procedure TForm1.Button2Click(Sender: TObject);//获取解密后的坐标
begin
wd_Decrypt:=Decrypt(wd_Encryption);//经度
jd_Decrypt:=Decrypt(jd_Encryption);//维度
end;
......