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

Method rotate

hashes/sha1.py:53–59  ·  view source on GitHub ↗

Static method to be used inside other methods. Left rotates n by b. >>> SHA1Hash('').rotate(12,2) 48

(n, b)

Source from the content-addressed store, hash-verified

51
52 @staticmethod
53 def rotate(n, b):
54 """
55 Static method to be used inside other methods. Left rotates n by b.
56 >>> SHA1Hash('').rotate(12,2)
57 48
58 """
59 return ((n << b) | (n >> (32 - b))) & 0xFFFFFFFF
60
61 def padding(self):
62 """

Callers 3

expand_blockMethod · 0.95
final_hashMethod · 0.95
circular_convolutionMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected