refactor to_bits

This commit is contained in:
kikito 2015-04-06 17:37:16 +02:00
parent 332517912d
commit 858b23b28d

11
md5.lua
View File

@ -100,13 +100,10 @@ else
-- to bits table -- to bits table
local tbl = {} local tbl = {}
local cnt = 1 local cnt = 1
while (n > 0) do local last
local last = math.mod(n,2) while n > 0 do
if(last == 1) then last = n % 2
tbl[cnt] = 1 tbl[cnt] = last
else
tbl[cnt] = 0
end
n = (n-last)/2 n = (n-last)/2
cnt = cnt + 1 cnt = cnt + 1
end end