0

I have a string that looks like

\x01\x03\x00\x00\x00\x01\x00\x00\x00\x1f\x00\x00\x00q~5\xf1\xacHhA\xd7[\x18>\x9erCA\x13\xf5Q\xa3\xadHhA\x17V\xde\x9f\x97rCA\xeb\x8a\x90\xea\xadHhA\x11\x1e\xaf5\x92rCA\xeb\x8a\x90\xea\xadHhA\xad\x8c\x8a\xff\x8drCA\xd7\xd5/\x0e\xaeHhA\xedPkc\x8arCAY\xe2\x8a\x07\xafHhAj|7_\x84rCA\x0f\x0e\x08\x96\xafHhA\x93\xcc\xfe\xc0}rCA\xe7\xa3F\xdd\xafHhAQ\xac\xd0VxrCA\xe7\xa3F\xdd\xafHhA\x80%\xb7TurCA\x0f

I'd like to convert it to binary encoded hex like

0102000020110F0000B802000060CB38045D344E4167866F87E25C4D41C88730520F344E4133683205B35C4D41A6719BE3C2334E41F2A9DA95665C4D41A2D14537D1334E415CFC777B285C4D41528DB9E018344E4180C29B0A075C4D4117D477C186344E41C1E177EEF35B4D41D83AC468F9344E41B9C5ECB5F85B4D41FED020BD32354E4178A8C9EEC85B4D4188F6371241354E41A60F877E7C5B4D41FDF0AE8337354E41AF16059E0E5B4D41EE45D6850C354E41B0F6E4D9B35A4D41B2644B87B6344E41ACAEE167

in python 2.7

As an added bonus, anyone know whats the q~5\xf1\xacHhA\xd7[\x18>\ part that doesn't look like hex :/

1

1 Answer 1

3
>>> '\x01\x03\x00\x00\x00\x01...'.encode('hex')
'0103000000012e2e2e'

As an added bonus...

It's hex values that fall within ASCII characters. Since you have a bytestring, values within ASCII are represented as text.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.