[fpc-pascal] SHA1 of a TMemoryStream
    Jorge Aldo G. de F. Junior 
    jagfj80 at gmail.com
       
    Sun Mar  6 01:34:32 CET 2011
    
    
  
I need to perform a Hash of data stored at a TMemoryStream...
But unfortunately, the following program spits out different results
if i run it in sucession... Note that the file being read (test6.pas)
never changes.
Uses
	Classes,
	SHA1;
Var
	Data : TMemoryStream;
	Hash : TSHA1Digest;
Begin
	Data := TMemoryStream.Create;
	Data.LoadFromFile('test6.pas');
	Hash := SHA1Buffer(Data.Memory, Data.Size);
	WriteLn(SHA1Print(Hash));
	Data.Free;
End.
Am i doing (probably) anything wrong ?
Thanks in advance.
    
    
More information about the fpc-pascal
mailing list