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

Function pad

hashes/md5.py:39–56  ·  view source on GitHub ↗

[summary] Fills up the binary string to a 512 bit binary string Arguments: bitString {[string]} -- [binary string] Returns: [string] -- [binary string]

(bitString)

Source from the content-addressed store, hash-verified

37 return thing
38
39def pad(bitString):
40 """[summary]
41 Fills up the binary string to a 512 bit binary string
42
43 Arguments:
44 bitString {[string]} -- [binary string]
45
46 Returns:
47 [string] -- [binary string]
48 """
49
50 startLength = len(bitString)
51 bitString += '1'
52 while len(bitString) % 512 != 448:
53 bitString += '0'
54 lastPart = format(startLength,'064b')
55 bitString += rearrange(lastPart[32:]) + rearrange(lastPart[:32])
56 return bitString
57
58def getBlock(bitString):
59 """[summary]

Callers 1

md5meFunction · 0.85

Calls 1

rearrangeFunction · 0.85

Tested by

no test coverage detected