Authenticator-Extension/Authenticator

Bits are lost when removing padding in function `base32tohex`

Closed this issue · 1 comments

hex = hex.substr(0, hex.length - 8);

I found an actual bug this time. @mymindstorm

Consider this example:

Input:

base32tohex("KK======")

Where KK is 01010 01010

Output in hex: 52 (01010 010)

The last 2 bits 10 have been lost.

The code to remove padding is removing too much.

KK is not a valid sequence of octets, my bad 😅