I was reading a Postgres/PostGIS statement like this:
SELECT ST_AsBinary(
ST_GeomFromWKB(
E\'\\\\001\\\\001\\\\000\\\\000\\\\000\\\\321\\\\256B\\\\312O\\\\
What you see does not look like hexadecimal, because the bytea string literal is in escape string syntax (which is rather outdated nowadays).
E'\\001\\001\\000\\000\\000\\321\\256B\\312O\\304Q\\300\\347\\030\\220\\275\\336%E@'
The same as "standard conforming string":
'\001\001\000\000\000\321\256B\312O\304Q\300\347\030\220\275\336%E@'
Both are in "escape format", which can be represented more efficiently in "hex format" as:
'\x0101000000d1ae42ca4fc451c0e71890bdde254540'
You can use encode() and decode() to transform one form into the other.
I answered your follow-up question on gis.SE with more details.