Black Panther
Black Panther

Reputation: 145

Delphi 'AsBinary'?

I have a field in the database which is SHA-256 (Binary type). I'm trying to retrieve it and compare it to the hash of a password typed by the user.

 If  (ADOQuery1.FieldByName('pass').AsString = '0x' + SHA256(Edit.Text) then

The comparison seem to not work even though the hashes are the same. If I have try to display the field from database into a Message box or something, I get the message in Chinese and I can't find any 'AsBinary' function, assuming that's the solution.

Upvotes: 0

Views: 136

Answers (1)

Arnaud Bouchez
Arnaud Bouchez

Reputation: 43043

Use AsBytes method to pass some binary content.

Upvotes: 3

Related Questions