aberaud / base91-python

A python implementation of Base91 as described on http://base91.sourceforge.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why 88 is used as a threshold. 89 should be fit perfectly

ennoausberlin opened this issue · comments

Hello, I just try to understand the 88 threshold in the encoding/decoding procedure.

n += 13 if (v & 8191) > 88 else 14

If I calculate 89*91+91 = 8190 I am still in the range of 13 bits. 0-8191. So for me 89 would fit better. 90 as second character of course needs 14 bits. Do I run into an off-by-one-error here? I am puzzled. Can you elaborate this, please?

Another thing that bugs me. If I decode """" (two double quotes) I get an X. But when I decode }A I also get an X. This should not happen if Base91 has a unique mapping. You can try this example here: https://www.dcode.fr/base-91-encoding