@@ -38,12 +38,12 @@ function sha256_file(file)
3838 W [i ] = string.byte (k , o ) << 24 | string.byte (k , o + 1 ) << 16 | string.byte (k , o + 2 ) << 8 | string.byte (k , o + 3 )
3939 end
4040 for i = 16 , 63 do -- Message expansion
41- local s0 , s1 = RR (W [i - 15 ], 7 ) ~ RR (W [i - 15 ], 18 ) ~ (W [i - 15 ] >> 3 ), RR (W [i - 2 ], 17 ) ~ RR (W [i - 2 ], 19 ) ~ (W [i - 2 ] >> 10 ) -- #squish keep-eol
41+ local s0 , s1 = RR (W [i - 15 ], 7 ) ~ RR (W [i - 15 ], 18 ) ~ (W [i - 15 ] >> 3 ), RR (W [i - 2 ], 17 ) ~ RR (W [i - 2 ], 19 ) ~ (W [i - 2 ] >> 10 )
4242 W [i ] = (W [i - 16 ] + s0 + W [i - 7 ] + s1 ) & M
4343 end
4444 local a , b , c , d , e , f , g , h = table.unpack (H )
4545 for i = 0 , 63 do
46- local S0 , S1 , ch , maj = RR (a , 2 ) ~ RR (a , 13 ) ~ RR (a , 22 ), RR (e , 6 ) ~ RR (e , 11 ) ~ RR (e , 25 ), (e & f ) ~ ((~e ) & g ), (a & b ) ~ (a & c ) ~ (b & c ) -- #squish keep-eol
46+ local S0 , S1 , ch , maj = RR (a , 2 ) ~ RR (a , 13 ) ~ RR (a , 22 ), RR (e , 6 ) ~ RR (e , 11 ) ~ RR (e , 25 ), (e & f ) ~ ((~e ) & g ), (a & b ) ~ (a & c ) ~ (b & c )
4747 local t1 , t2 = (h + S1 + ch + K [i + 1 ] + W [i ]) & M , (S0 + maj ) & M
4848 h = g
4949 g = f
@@ -68,11 +68,11 @@ function sha256_file(file)
6868 --- @param l number The length of the message in bytes
6969 --- @return string The padding string to append to the message
7070 local function P (l )
71- local ml , p , pl = l * 8 , " \128 " , 56 - (l % 64 ) -- #squish keep-eol
71+ local ml , p , pl = l * 8 , " \128 " , 56 - (l % 64 )
7272 if pl <= 0 then
7373 pl = pl + 64
7474 end
75- p = p .. string.rep (" \0 " , pl - 1 ) -- #squish keep-eol
75+ p = p .. string.rep (" \0 " , pl - 1 )
7676 for i = 7 , 0 , - 1 do
7777 p = p .. string.char ((ml >> (i * 8 )) & 0xFF )
7878 end
@@ -100,7 +100,7 @@ function sha256_file(file)
100100 for _ , v in ipairs (H ) do
101101 table.insert (l , h (v ))
102102 end
103- return table.concat (l ) -- #squish keep-eol
103+ return table.concat (l )
104104end
105105
106106if LIB then
@@ -109,16 +109,16 @@ end
109109
110110if # arg < 1 then
111111 print ((arg [- 1 ] or " ?" ) .. " " .. (arg [0 ] or " ?" ) .. " [FILE]..." )
112- os.exit (1 ) -- #squish keep-eol
112+ os.exit (1 )
113113else
114114 for i = 1 , # arg do
115- local f , e = io.open (arg [i ], " rb" ) -- #squish keep-eol
115+ local f , e = io.open (arg [i ], " rb" )
116116 if not f then
117117 print (e )
118118 os.exit (1 )
119119 end
120120 local sum = sha256_file (f )
121- f :close () -- #squish keep-eol
121+ f :close ()
122122 if sum then
123123 print (sum .. " " .. arg [i ])
124124 else
0 commit comments