i need to conver strings like that "aa28f5c91a24293a3278" to get result in bytes, like that "b'\xaa(\xf5\xc9\x1a$):2x'" How to do that in python? thanks!
1 Answer
With bytes.fromhex(my_hex_string):
>>> s = "aa28f5c91a24293a3278"
>>> bytes.fromhex(s)
b'\xaa(\xf5\xc9\x1a$):2x'
This bytes class method returns a
bytesobject, decoding the given string object. The string must contain two hexadecimal digits per byte, with ASCII whitespace being ignored.
"aa28f5c91a24293a3278".encode()