Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ActiveState/code
/ bin2hex
Function
bin2hex
recipes/Python/576598_Utility_Mill_Test/recipe-576598.py:165–166 ·
view source on GitHub ↗
(x)
Source
from the content-addressed store, hash-verified
163
return
decoded
164
165
def
bin2hex(x):
166
return
''
.join(
'%02X'
% ord(y)
for
y in x)
167
168
def
hex2bin(x):
169
return
''
.join(chr(int(x[y:y+2], 16))
for
y in range(0, len(x), 2))
Callers
2
test_encode
Function · 0.85
test_decode
Function · 0.85
Calls
1
join
Method · 0.45
Tested by
2
test_encode
Function · 0.68
test_decode
Function · 0.68