Open coolaj86 opened 2 years ago
Sorry I don't get the issue? Assuming your are concerned about the encodings are different compared to other library? Would like to understand why do you think that different values for encoding is an issue? It will always be dependent on the underlying implementation.
Following two conditions are sufficient to test for correctness:
Looking at the output it seems that the library you have used is more efficient as it can encode same string in less number of characters.
Would like to understand why do you think that different values for encoding is an issue?
It will always be dependent on the underlying implementation.
Yes, but if one base64 library can't decode the output of another base64 library that's not "an implementation detail", it's a bug.
Likewise, if you're creating your own methodology for a different type of base62 than the defacto standard that's been around since the 90s with GMP and GnuPG, then you're literally creating your own definition of "base62".
Also, I don't think that you're simply using a different alphabet or encoding scheme, I think that your math is actually incorrect, but in a way that just happens to work in both directions.
Just like converting between hex and decimal we could use a special alphabet rather than 0-9A-F, however, the algorithm should never change. It's a mathematical constant.
I found this code via the article https://medium.com/analytics-vidhya/base-62-text-encoding-decoding-b43921c7a954.
However, this base62 implementation seems to give different output from other implementations.
Reference Implementation
https://github.com/keybase/saltpack/encoding/basex seems to be correct and agree with other implementations:
Results:
Your results