Skip to content

Encode func return the incorrect base32 string #381

@haleygu64

Description

@haleygu64

Details:

call Encode32(Buffer.from(2cwnayytkdv6k2z5rmw1h2tl6byt52q3))
expected: GJRXO3TBPF4XI23EOY3GWMT2GVZG25ZRNAZHI3BWMJ4XINJSOEZQ
return: GJRXO3TBPF4XI23EOY3GWMT2GVZG25ZRNAZHI3BWMJ4XINJSOEZB

for (let i = 0; i < binary.length; i += 5) {
    const chunk = binary.substring(i, i + 5); //return incorrect binary in the end of input, i.e should return 10000 instead of 1
    base32 += BASE32_CHARS[parseInt(chunk, 2)];
  }

https://github.com/PlanetHoster/time2fa/blob/d3baa4214cdbca0547fffd1ee818a98faad04e0a/src/utils/encode.ts#L19C3-L22C4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions