lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Sep 5, 2022 at 1:51 AM luiz wrote:

    https://codeberg.org/bloataware/bin/src/branch/main/dpg

Well... What do you think?


1) The following line decreases "bignum" precision from 64 to 53 bits:
math.floor(bignum / #chars)
Integer division operator // should be used instead.
BTW, 64 bit "bignum" gives only a 10-bytes long password.  Is it enough?

2) The "remainder" may be zero, and chars:sub(0,0) will be an empty string.
local remainder = math.fmod(bignum, #chars)
local password = chars:sub(remainder, remainder)