Fórum criptografia #282201

19/05/2005

0

ae galera.. como eu faço pra criptografar alguem tem uma fuunção ou código, coisa simples não precisa ser mto sofisticada :D


Slack

Slack

Responder

Posts

19/05/2005

Fernando

function Crypt(Action, Src: String): String;
Label Fim;
var KeyLen : Integer;
KeyPos : Integer;
OffSet : Integer;
Dest, Key : String;
SrcPos : Integer;
SrcAsc : Integer;
TmpSrcAsc : Integer;
Range : Integer;
begin
if (Src = ´´) Then
begin
Result:= ´´;
Goto Fim;
end;
Key :=
´YUQL23KL23DF90WI5E1JAS467NMCXXL6JAOAUWWMCL0AOMM4A4VZYW9KHJUI2347EJHJKDF3424SKL K3LAKDJSL9RTIKJ´;
Dest := ´´;
KeyLen := Length(Key);
KeyPos := 0;
// SrcPos := 0;
// SrcAsc := 0;
Range := 256;
if (Action = UpperCase(´C´)) then
begin
Randomize;
OffSet := Random(Range);
Dest := Format(´¬1.2x´,[OffSet]);
for SrcPos := 1 to Length(Src) do
begin
Application.ProcessMessages;
SrcAsc := (Ord(Src[SrcPos]) + OffSet) Mod 255;
if KeyPos < KeyLen then KeyPos := KeyPos + 1 else KeyPos := 1;
SrcAsc := SrcAsc Xor Ord(Key[KeyPos]);
Dest := Dest + Format(´¬1.2x´,[SrcAsc]);
OffSet := SrcAsc;
end;
end
Else if (Action = UpperCase(´D´)) then
begin
OffSet := StrToInt(´$´+ copy(Src,1,2));
SrcPos := 3;
repeat
SrcAsc := StrToInt(´$´+ copy(Src,SrcPos,2));
if (KeyPos < KeyLen) Then KeyPos := KeyPos + 1 else KeyPos := 1;
TmpSrcAsc := SrcAsc Xor Ord(Key[KeyPos]);
if TmpSrcAsc <= OffSet then TmpSrcAsc := 255 + TmpSrcAsc - OffSet
else TmpSrcAsc := TmpSrcAsc - OffSet;
Dest := Dest + Chr(TmpSrcAsc);
OffSet := SrcAsc;
SrcPos := SrcPos + 2;
until (SrcPos >= Length(Src));
end;
Result:= Dest;
Fim:
end;


vc usa da seguinte forma
Crypt(´C´,SENHA.Text); // criptografa
Crypt(´D´,SENHA.Text); // Descriptografa


Responder

Gostei + 0

19/05/2005

Ericlemes

Fala Slack,

Procure alguns componentes sobre criptografia chamados ´LockBox´ é um set de componentes gratuítos com fonte, que implementam uma série de algorítmos de Hash e criptografia (MD5, SHA1, BlowFish, RSA, etc).

A mais simples e funcional é a blowfish. Agora se vc pretende fazer algo ultra-seguro, vale a pena pensar num método mais sofisticado.


[]´s

Eric Lemes


Responder

Gostei + 0

13/09/2005

Armando.boza

function Crypt(Action, Src: String): String; Label Fim; var KeyLen : Integer; KeyPos : Integer; OffSet : Integer; Dest, Key : String; SrcPos : Integer; SrcAsc : Integer; TmpSrcAsc : Integer; Range : Integer; begin if (Src = ´´) Then begin Result:= ´´; Goto Fim; end; Key := ´YUQL23KL23DF90WI5E1JAS467NMCXXL6JAOAUWWMCL0AOMM4A4VZYW9KHJUI2347EJHJKDF3424SKL K3LAKDJSL9RTIKJ´; Dest := ´´; KeyLen := Length(Key); KeyPos := 0; // SrcPos := 0; // SrcAsc := 0; Range := 256; if (Action = UpperCase(´C´)) then begin Randomize; OffSet := Random(Range); Dest := Format(´¬1.2x´,[OffSet]); for SrcPos := 1 to Length(Src) do begin Application.ProcessMessages; SrcAsc := (Ord(Src[SrcPos]) + OffSet) Mod 255; if KeyPos < KeyLen then KeyPos := KeyPos + 1 else KeyPos := 1; SrcAsc := SrcAsc Xor Ord(Key[KeyPos]); Dest := Dest + Format(´¬1.2x´,[SrcAsc]); OffSet := SrcAsc; end; end Else if (Action = UpperCase(´D´)) then begin OffSet := StrToInt(´$´+ copy(Src,1,2)); SrcPos := 3; repeat SrcAsc := StrToInt(´$´+ copy(Src,SrcPos,2)); if (KeyPos < KeyLen) Then KeyPos := KeyPos + 1 else KeyPos := 1; TmpSrcAsc := SrcAsc Xor Ord(Key[KeyPos]); if TmpSrcAsc <= OffSet then TmpSrcAsc := 255 + TmpSrcAsc - OffSet else TmpSrcAsc := TmpSrcAsc - OffSet; Dest := Dest + Chr(TmpSrcAsc); OffSet := SrcAsc; SrcPos := SrcPos + 2; until (SrcPos >= Length(Src)); end; Result:= Dest; Fim: end; vc usa da seguinte forma Crypt(´C´,SENHA.Text); // criptografa Crypt(´D´,SENHA.Text); // Descriptografa



Amigo, ta dando erro na hora de descriptografar .... ta dizendo isso´ $T8 is not a integer value´ ...

O que pode ser?
E aquela Key que tem um monte de letras e numeros, qual a diferença se mudar?


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar