MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / padding

Method padding

hashes/sha1.py:61–67  ·  view source on GitHub ↗

Pads the input message with zeros so that padded_data has 64 bytes or 512 bits

(self)

Source from the content-addressed store, hash-verified

59 return ((n << b) | (n >> (32 - b))) & 0xFFFFFFFF
60
61 def padding(self):
62 """
63 Pads the input message with zeros so that padded_data has 64 bytes or 512 bits
64 """
65 padding = b"\x80" + b"\x00" * (63 - (len(self.data) + 8) % 64)
66 padded_data = self.data + padding + struct.pack(">Q", 8 * len(self.data))
67 return padded_data
68
69 def split_blocks(self):
70 """

Callers 1

final_hashMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected