lua-users home
lua-l archive

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


Thank you for the reply.

I actually wrote this script exclusively for Lua 5.1, so the first issue is
"fixed" as far as I can see. Now, for the second issue the only solution that
wouldn't bias the output (and wouldn't change how Lua handles indexing) would be
to skip the iteration if the remainder is zero. What are your thoughts on this?

Sincerely,
luiz

Sep 5, 2022, 20:26 by egor.skriptunoff@gmail.com:

> 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)