Fórum Expirar programa #417048
18/05/2012
0
function GeraCod(Cad: string):string;
const
Chave:string = ´j5Klmljk2hUV4A´;
var
Cod:string;
Pdt,Sm,x,y,w:integer;
Psc: array[1..100] of integer;
begin
for x:=1 to 26 do Cod:=Cod+Chr(64+x)+Chr(123-x);
Cad:=Chave+Cad;
Cod:=Cod+Cad;
for y:=1 to Length(Cad) do
begin
x:=0;
repeat x:=x+1;
until Cad[y]=Cod[x];
Psc[y]:=x;
end;
Sm:=0;
Result:=´´;
y:=Length(Cad);
Cod:=´69ADGJMPSVYX147BEHKNQOTWZ258CF0ILRU3´;
for x:=1 to 4 do
begin
for w:=1 to y do
begin
Pdt:=Psc[w]*(y-w+2);
Sm:=Sm+Pdt;
end;
Sm:=(Sm mod 36)+1;
Result:=Result+Cod[Sm];
y:=y+1;
Psc[y]:=Sm;
Sm:=0;
end;
end;
function GeraSenha(Str: string): string;
begin
Result:=GeraCod(Str);
Result:=Result+´-´+GeraCod(Result);
Result:=Result+´-´+GeraCod(Result);
end;
end.
{Teste do código}
procedure TForm1.FormActivate(Sender: TObject);
begin
Edit1.Text:=(GeraCod(SerialNum(´C´)));
Label1.caption:=´Chave: ´+GeraSenha(Edit1.Text);
end;
{Para testar , digite a Chave no Edit2}
procedure TForm1.Button1Click(Sender: TObject);
begin
if Edit2.Text=GeraSenha(Edit1.Text)then
ShowMessage(´Chave Confere´)else
ShowMessage(´Chave Não Confere´);
end;
Klaus
Curtir tópico
+ 0Posts
19/05/2012
Bruno Leandro
Gostei + 0
20/05/2012
Klaus
Gostei + 0
21/05/2012
Ricardo Matarazzo
Gostei + 0
21/05/2012
Klaus
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)