MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / bin2hex

Function bin2hex

Python/des.py:30–56  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

28
29
30def bin2hex(s):
31 mp = {"0000": '0',
32 "0001": '1',
33 "0010": '2',
34 "0011": '3',
35 "0100": '4',
36 "0101": '5',
37 "0110": '6',
38 "0111": '7',
39 "1000": '8',
40 "1001": '9',
41 "1010": 'A',
42 "1011": 'B',
43 "1100": 'C',
44 "1101": 'D',
45 "1110": 'E',
46 "1111": 'F'}
47 hex = ""
48 for i in range(0, len(s), 4):
49 ch = ""
50 ch = ch + s[i]
51 ch = ch + s[i + 1]
52 ch = ch + s[i + 2]
53 ch = ch + s[i + 3]
54 hex = hex + mp[ch]
55
56 return hex
57
58# Binary to decimal conversion
59

Callers 2

encryptFunction · 0.85
des.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected