1414class KeccakSHA3 :
1515 # Round constants
1616 _RC : ClassVar [list [int ]] = [
17- 0x0000000000000001 , 0x0000000000008082 , 0x800000000000808A ,
18- 0x8000000080008000 , 0x000000000000808B , 0x0000000080000001 ,
19- 0x8000000080008081 , 0x8000000000008009 , 0x000000000000008A ,
20- 0x0000000000000088 , 0x0000000080008009 , 0x000000008000000A ,
21- 0x000000008000808B , 0x800000000000008B , 0x8000000000008089 ,
22- 0x8000000000008003 , 0x8000000000008002 , 0x8000000000000080 ,
23- 0x000000000000800A , 0x800000008000000A , 0x8000000080008081 ,
24- 0x8000000000008080 , 0x0000000080000001 , 0x8000000080008008 ,
17+ 0x0000000000000001 ,
18+ 0x0000000000008082 ,
19+ 0x800000000000808A ,
20+ 0x8000000080008000 ,
21+ 0x000000000000808B ,
22+ 0x0000000080000001 ,
23+ 0x8000000080008081 ,
24+ 0x8000000000008009 ,
25+ 0x000000000000008A ,
26+ 0x0000000000000088 ,
27+ 0x0000000080008009 ,
28+ 0x000000008000000A ,
29+ 0x000000008000808B ,
30+ 0x800000000000008B ,
31+ 0x8000000000008089 ,
32+ 0x8000000000008003 ,
33+ 0x8000000000008002 ,
34+ 0x8000000000000080 ,
35+ 0x000000000000800A ,
36+ 0x800000008000000A ,
37+ 0x8000000080008081 ,
38+ 0x8000000000008080 ,
39+ 0x0000000080000001 ,
40+ 0x8000000080008008 ,
2541 ]
2642
2743 _ROT : ClassVar [list [list [int ]]] = [
@@ -93,9 +109,9 @@ def _absorb(self) -> None:
93109 padded = self ._pad (self .msg )
94110
95111 for off in range (0 , len (padded ), rate_bytes ):
96- block = padded [off : off + rate_bytes ]
112+ block = padded [off : off + rate_bytes ]
97113 for i in range (0 , rate_bytes , 8 ):
98- lane = struct .unpack ("<Q" , block [i : i + 8 ])[0 ]
114+ lane = struct .unpack ("<Q" , block [i : i + 8 ])[0 ]
99115 x = (i // 8 ) % 5
100116 y = (i // 8 ) // 5
101117 self .state [x ][y ] ^= lane
@@ -119,6 +135,7 @@ def _squeeze(self) -> bytes:
119135
120136# ================= CLI =================
121137
138+
122139def main () -> None :
123140 parser = argparse .ArgumentParser (description = "SHA-3 hashing tool" )
124141 parser .add_argument ("-s" , "--string" , help = "String input" )
0 commit comments