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

str<->bytes codecs adding bytes #41

Closed
tomatopeel opened this issue Oct 27, 2016 · 2 comments
Closed

str<->bytes codecs adding bytes #41

tomatopeel opened this issue Oct 27, 2016 · 2 comments

Comments

@tomatopeel
Copy link

(nonce/random-nonce 8)
=> [0, 0, 1, 88, 4, -48, 62, -60]

(-> (nonce/random-nonce 8)
    (codecs/bytes->str)
    (codecs/str->bytes))
=> [0, 0, 1, 88, 4, -17, -65, -67, -17, -65, -67, -17, -65, -67]

This can't be right can it?

@niwinz
Copy link
Member

niwinz commented Oct 27, 2016

The wrong stuff is using bytes->str function here. That function interprets the bytes in utf8 but random-nonce return random data, not utf8 encoded text.

@tomatopeel
Copy link
Author

Aha, so random-nonce's bytes should never be bytes->str'd, I see. Sorry, thanks for your time, great work on this wonderful library!

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