I can't explain this. I have a function which takes a stream and returns a
hash of it. I wrote a wrapper that takes a string and passes it to the hash
function as a stream. It looks like this:
function HashString(const AString: String): String;
var
Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
Stream.WriteBuffer(AString, Length(AString));
Stream.Seek(0, 0);
Result := MakeHash(Stream);
Stream.Free;
end;
For some reason this returns a different hash every time for the same input.
If I force AString to a value for testing, eg:
...
begin
AStream := 'testval';
Stream := TMemoryStream.Create;
...
it works fine! I've checked and double checked that, yes, the incoming
AString value is correct, and I know for a fact that MakeHash is
bulletproof.
Am I missing something?
========================================================
Luke Pascoe Delphi Programmer
enSynergy Consulting LTD
[EMAIL PROTECTED] +64-9-3551593 fax +64-9-3551590
Level 4, 10-12 Federal St, Auckland, New Zealand
PO Box 32521, Devonport, Auckland 1330, New Zealand
================== I.H.T.F.P. ==========================
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"