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

Bug #6

Closed
andreis opened this issue Nov 12, 2017 · 3 comments
Closed

Bug #6

andreis opened this issue Nov 12, 2017 · 3 comments

Comments

@andreis
Copy link

andreis commented Nov 12, 2017

	in := "1111111111"
	fmt.Println("in: ", in)
	v, err := base58.Decode(in)
	fmt.Println("decode:", v, err)

	fmt.Println("encode again:", base58.Encode(v))

Try this with your function names instead (by the way, I suggest you get rid of Trivial* and rename the fast versions to Encode and Decode). Output should look like this:

in:  1111111111
decode: [0 0 0] <nil>
encode again: 111
@mr-tron
Copy link
Owner

mr-tron commented Nov 12, 2017

Thanks for bug report.
This is problem in FastDecoding implementation, which was written by @njones. Excuse me that I merged without good testing.
I made functions Encode and Decode which call fast version for encoding and trivilal for decoding (as fast workaround).
I will fix fast decoding implementation tomorrow.

@andreis
Copy link
Author

andreis commented Nov 12, 2017

No worries Denis, I switched to btcutil until you sort this one out, I would love to use your much faster code. (after all we use base58 for tokens so it's definitely a hot path for us)

I think you can adapt these simple tests very easily https://github.com/btcsuite/btcutil/blob/master/base58/base58_test.go

@mr-tron
Copy link
Owner

mr-tron commented Nov 13, 2017

fixed 44792f7

@mr-tron mr-tron closed this as completed Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants