Question

How to convert string hex, into array of int 8?

var hash : string;
    x: array[0..19] of int8;

begin
   hash := '713BD6D36D4964F4E4F843CB03D118EA5C372FF6';
   put_hash_into_x(hash);
end;

Thanks

Was it helpful?

Solution

Use HexToBin:

HexToBin(PChar(hash), x, SizeOf(x));

Now, the docs say:

The hexadecimal number must use lower-case characters; HexToBin does not recognize upper-case characters.

But it turns out that this statement is incorrect and HexToBin works no matter what case text you give it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top