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

doesn't encode empty bytes properly? #1

Closed
oconnor663 opened this issue Apr 6, 2015 · 5 comments
Closed

doesn't encode empty bytes properly? #1

oconnor663 opened this issue Apr 6, 2015 · 5 comments

Comments

@oconnor663
Copy link
Contributor

I think the empty byte string b'' should encode to the empty string "". Instead, it currently encodes to "11".

Similarly, the string "1" should decode to the byte b'\x00'. Instead, it currently decodes to b'\x00\x00'.

I'm not totally sure about the right behavior for Base58 padding, but I think at least it should be possible to round-trip any string of bytes. Right now if you send any number of zero-bytes (including the empty bytestring) through encode+decode, you get a different number of bytes back out.

@keis
Copy link
Owner

keis commented Apr 7, 2015

Hi.

Thanks for the report. Fixing the encoding of empty buffer should be pretty easy I think. I'll see if I can add some fuzzing tests for validating the round-trip.

@keis
Copy link
Owner

keis commented Apr 8, 2015

should be fixed now. would you mind giving master a spin before I cut a release?

@oconnor663
Copy link
Contributor Author

Works for me. I threw in another (few hundred) round trip tests in a loop just in case: #3

@keis
Copy link
Owner

keis commented Apr 9, 2015

The freshly cut 0.2.2 release has this fix now :)

@keis keis closed this as completed Apr 9, 2015
@oconnor663
Copy link
Contributor Author

Awesome, thanks.

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