MCPcopy Create free account
hub / github.com/ActiveState/code / hexstring2string

Function hexstring2string

recipes/Python/299133_bubblebabble/recipe-299133.py:50–55  ·  view source on GitHub ↗

convert hex representation of digest back to raw digest

(s)

Source from the content-addressed store, hash-verified

48 return retval
49
50def hexstring2string(s):
51 """convert hex representation of digest back to raw digest"""
52 assert (len(s) % 2 == 0)
53 if s.startswith("0x") or s.startswith("0X"):
54 s = s[2:]
55 return "".join([chr(eval("0x%s" % s[i:i+2])) for i in range(0, len(s), 2)])
56
57def _test():
58 tests = """432cc46b5c67c9adaabdcc6c69e23d6d xibod-sycik-rilak-lydap-tipur-tifyk-sipuv-dazok-tixox

Callers 1

_testFunction · 0.85

Calls 3

rangeFunction · 0.85
startswithMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected