base91-python icon indicating copy to clipboard operation
base91-python copied to clipboard

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

Open ennoausberlin opened this issue 2 years ago • 1 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?

ennoausberlin avatar Dec 01 '23 08:12 ennoausberlin

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

ennoausberlin avatar Dec 01 '23 10:12 ennoausberlin