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

Method expand_block

hashes/sha1.py:78–86  ·  view source on GitHub ↗

Takes a bytestring-block of length 64, unpacks it to a list of integers and returns a list of 80 integers after some bit operations

(self, block)

Source from the content-addressed store, hash-verified

76
77 # @staticmethod
78 def expand_block(self, block):
79 """
80 Takes a bytestring-block of length 64, unpacks it to a list of integers and
81 returns a list of 80 integers after some bit operations
82 """
83 w = list(struct.unpack(">16L", block)) + [0] * 64
84 for i in range(16, 80):
85 w[i] = self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]), 1)
86 return w
87
88 def final_hash(self):
89 """

Callers 1

final_hashMethod · 0.95

Calls 1

rotateMethod · 0.95

Tested by

no test coverage detected