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

Function hex2bin

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

Source from the content-addressed store, hash-verified

3# Hexadecimal to binary conversion
4
5def hex2bin(s):
6 mp = {'0': "0000",
7 '1': "0001",
8 '2': "0010",
9 '3': "0011",
10 '4': "0100",
11 '5': "0101",
12 '6': "0110",
13 '7': "0111",
14 '8': "1000",
15 '9': "1001",
16 'A': "1010",
17 'B': "1011",
18 'C': "1100",
19 'D': "1101",
20 'E': "1110",
21 'F': "1111"}
22 bin = ""
23 for i in range(len(s)):
24 bin = bin + mp[s[i]]
25 return bin
26
27# Binary to hexadecimal conversion
28

Callers 2

encryptFunction · 0.85
des.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected