Fórum criptografia #282201
19/05/2005
0
Slack
Curtir tópico
+ 0Posts
19/05/2005
Fernando
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
Gostei + 0
19/05/2005
Ericlemes
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
Gostei + 0
13/09/2005
Armando.boza
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?
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)