Qual a melhor maneira de cripitografar um código ?
26/11/2009
0
Gostaria que me ajudassem postando algumas funções de cripitografar....vlw
Consaude
Curtir tópico
+ 0
Responder
Posts
26/11/2009
Fábio Cruz
tente essas funções
function Cripto(Texto: String): String;
var
Cont, Cod: Integer;
Retorna: String;
begin
for Cont := 1 to Length(Texto) do
begin
Cod := ValorAsc(Copy(Texto, Cont, 1));
Retorna := Retorna + Chr(Cod + 57(*valor a ser adicionado - pode ser modificado*));
end;
Cripto := Retorna;
end;
function DesCripto(Texto: String): String;
var
Cont, Cod: integer;
Retorna: String;
begin
for Cont := 1 to Length(Texto) do begin
Cod := ValorAsc(Copy(Texto, Cont, 1));
Retorna := Retorna + Chr(Cod - 57);
end;
DesCripto := Retorna;
end;
function ValorAsc(Letra: String): Byte;
begin
if Length(letra) > 0 then ValorAsc := Ord(Letra[1]) else ValorAsc := 0;
end;
function Cripto(Texto: String): String;
var
Cont, Cod: Integer;
Retorna: String;
begin
for Cont := 1 to Length(Texto) do
begin
Cod := ValorAsc(Copy(Texto, Cont, 1));
Retorna := Retorna + Chr(Cod + 57(*valor a ser adicionado - pode ser modificado*));
end;
Cripto := Retorna;
end;
function DesCripto(Texto: String): String;
var
Cont, Cod: integer;
Retorna: String;
begin
for Cont := 1 to Length(Texto) do begin
Cod := ValorAsc(Copy(Texto, Cont, 1));
Retorna := Retorna + Chr(Cod - 57);
end;
DesCripto := Retorna;
end;
function ValorAsc(Letra: String): Byte;
begin
if Length(letra) > 0 then ValorAsc := Ord(Letra[1]) else ValorAsc := 0;
end;
Responder
Clique aqui para fazer login e interagir na Comunidade :)