-
Notifications
You must be signed in to change notification settings - Fork 126
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
Null characters in return buffer #101
Comments
… _str_verify is willing to accept such a string now. Adjust all 3 variants and add a test.
Isn't it by design? In the libsodium docs it says,
Assuming that the output buffer is always the same size but is null-padded, it would follow that to store the key in a database as a string, you'd need the string to be padded too. Otherwise when you regenerate the key in |
The string itself can be shorter, and should be trimmed after the first |
I see! Thanks, that's helpful. |
Do I need to close the Issue Before or After the PR is merged? Thanks for the help. |
Is it documented somewhere that you have to strip off the \0 bytes? Or is there any interest in removing them automatically? We just had the same issue encoding/decoding from base64 and it took us a little while to track down the error. |
Hello, I've started using the module, but when calling:
password_out is a buffer (as it is supposed to) and contains null characters.
These are not stripped even after calling password_out.toString('ascii').
Although, printing on console using console.log strips them.
Is this by design? How to get rid of the trailing nulls?
The goal is to send the response inside a JSON object like:
Thanks in advance.
The text was updated successfully, but these errors were encountered: