Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Encoding of ffffffffffffffffffffffffffffffff #4

Open
theory opened this issue Jun 23, 2022 · 4 comments
Open

Incorrect Encoding of ffffffffffffffffffffffffffffffff #4

theory opened this issue Jun 23, 2022 · 4 comments
Labels
wontfix This will not be worked on

Comments

@theory
Copy link

theory commented Jun 23, 2022

Compare the output from jxskiss/base62 to that from keys-pub/keys/encoding:

package main

import (
	"fmt"

	"github.com/jxskiss/base62"
	"github.com/keys-pub/keys/encoding"
)

func main() {
	id := []byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
	fmt.Println(base62.EncodeToString(id[:]))
	fmt.Println(encoding.EncodeBase62(id[:]))
}

Output:

fffffffffffffffffffffffffH
7n42DGM5Tflk9n8mt7Fhc7

I believe keys-pub/keys/encoding is correct and jxskiss/base62 is not.

@theory
Copy link
Author

theory commented Jun 23, 2022

FWIW, encoding/base64 emits _____________________w.

@theory
Copy link
Author

theory commented Jun 23, 2022

Playground

@jxskiss
Copy link
Owner

jxskiss commented Jun 26, 2022

The two libraries use different algorithm to do encoding, which generates different output. You may read READM.md for details about the algorithm.

@theory
Copy link
Author

theory commented Jun 26, 2022

Interesting. I was just super surprised to see it be so uniform and long.

@jxskiss jxskiss added the wontfix This will not be worked on label Jul 8, 2022
Repository owner deleted a comment from huzhen-v5 Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants