Abadis
Abadis

Reputation: 2841

how can i decode a hex string?

How can I decode a hex string to an ascii string? I want to find the meaning of

559EF4BE-D2E1-4009-AF7B-F81784946A89

or

81CB80D6-62C3-4BC8-99BE-31D7C6E739A4

Thanks

Upvotes: 0

Views: 522

Answers (2)

dcoder
dcoder

Reputation: 13351

Just a small clarification: 'ASCII string' refers to the charset used to represent the characters, not whether or not these chars are represented as int, hex or as printable characters...

Anyways, what I assume you actually want is a program which will show the printable version of the characters. So here's one way to do it in python:

import re

pattern = "559EF4BE-D2E1-4009-AF7B-F81784946A89" #replace this with the hex string you want
hex_list = re.findall("[a-zA-Z0-9]{2}",pattern)
for h in hex_list:
    i = int(h,16)
    ascii_val = chr(i)
    print ascii_val,

Good luck.

BTW, hex strings as you presented them, are not usually meant to represent strings. Are you sure that's what you need?

Upvotes: 1

Emil Vikström
Emil Vikström

Reputation: 91983

This looks like a GUID which is just a complex id number. They did historically carry some information about the system they were created on but nowadays is just random.

Upvotes: 1

Related Questions