Forum > General
DCPCrypt sha1 output how?
(1/1)
Treco:
I'm using DCPCrypt but I have problem to write the output (i dont know how)
here's the code that Im trying as example...
--- Code: ---type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
DCP_sha1_1: TDCP_sha1;
Hash: TDCP_sha1;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
Texto: String;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Hash:= TDCP_sha1.Create(nil);
Hash.Init;
Hash.UpdateStr('CP08171AB');
Hash.Final(Output);
texto := Output; //to pass the output to a string
Hash.Free;
Memo1.Text:=texto;
end;
initialization
{$I wifimeo.lrs}
end.
--- End code ---
Thanks for the help :D
Marc:
Where and how is output defined
Treco:
with:
--- Code: ---var
Form1: TForm1;
Texto: String;
Output: String;
--- End code ---
error on click
Error: Project x.exe raised exception class 'External: SIGSEGB'.
with:
--- Code: ---var
Form1: TForm1;
Texto: String;
Output: integer;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Hash:= TDCP_sha1.Create(nil);
Hash.Init;
Hash.UpdateStr('CP08171AB');
Hash.Final(Output);
texto := inttostr(Output); //to pass the output to a string
Hash.Free;
Memo1.Text:=texto;
end;
--- End code ---
same error but on exit the program
Error: Project x.exe raised exception class 'External: SIGSEGB'.
but got some output:
-1925152088
DCPcrypt
--- Code: ---Hash.Final(var Digest)
--- End code ---
what kinda var is?
Treco:
Found the error...
My problem for eat some paragraphs that past by in the documentation.
:'(
The var is type of array...
--- Code: ---var
Form1: TForm1;
Texto: String;
Output: array [1..20] of byte;
i: integer;
implementation
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Hash:= TDCP_sha1.Create(nil);
Hash.Init;
Hash.UpdateStr('CP0817314142');
Hash.Final(Output);
Hash.Free;
texto:='';
for i:=1 to 20 do
texto:=texto+inttohex(Output[i],1);
Memo1.Text:=texto;
end;
--- End code ---
Now works great :D
Thank you for your time!
Navigation
[0] Message Index