MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / rearrange

Function rearrange

hashes/md5.py:4–23  ·  view source on GitHub ↗

[summary] Regroups the given binary string. Arguments: bitString32 {[string]} -- [32 bit binary] Raises: ValueError -- [if the given string not are 32 bit binary string] Returns: [string] -- [32 bit binary string]

(bitString32)

Source from the content-addressed store, hash-verified

2import math
3
4def rearrange(bitString32):
5 """[summary]
6 Regroups the given binary string.
7
8 Arguments:
9 bitString32 {[string]} -- [32 bit binary]
10
11 Raises:
12 ValueError -- [if the given string not are 32 bit binary string]
13
14 Returns:
15 [string] -- [32 bit binary string]
16 """
17
18 if len(bitString32) != 32:
19 raise ValueError("Need length 32")
20 newString = ""
21 for i in [3,2,1,0]:
22 newString += bitString32[8*i:8*i+8]
23 return newString
24
25def reformatHex(i):
26 """[summary]

Callers 2

padFunction · 0.85
getBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected