August 15th, 2000, 07:54 PM
I have a situation where I have an
8-byte string which is represented as
16 hex digits. How do I convert a 16 hex
digit string to an 8-byte binary string?
I know I can use bin2hex to go from
a binary string to a hex string (very useful)
but is there a way to go the other direction?
Right now I have a solution, which is
to use a loop to go through the hex string
one byte at a time, but that doesn't seem
like a good way to do it. It seems
like I should be able to use the pack()
command, but I can't get it to work.
August 15th, 2000, 08:02 PM
Never mind. I figured it out.
I can use:
For some reason, this works. I was
initially trying to use pack("H8", ...)
but for some reason that didn't work.
So now I can pack with pack and unpack