-
Notifications
You must be signed in to change notification settings - Fork 18
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
[API] Use std::vector<uint8_t> instead of std:string #16
Comments
By the way, we have some modifications of the code including better support for locking secrets in memory e.g. "locked_string" - that will be offered as PR in some time in future if sodiumpp would change to vector<uint8_t> then we can easily follow that in our small patchset as well. |
std::string was already used by the original NaCl C++ API, and I'd like to keep it that way for the low level API. For the high level API std::vector<uint8_t> is fine for me, but you would have to convert between the two when calling the low level API, which may get messy. I do think that using std::string will be more convenient for people to use, as you'll probably have your data as an std::string anyway when you're reading files. |
When a programmer looks at an API and sees When designing API's they should be intuitive for those who use them. |
I agree that |
std::string is a binary container, so there's no need really. programmer expecting utf8 in a std::string should better go read the stdlib documentation. |
It could, but if you're concerned with cleansing() the container it will work correctly regardless of SSO. |
When looking through the design of sodiumpp, I'm curious of the choice of std:string.
I would have thought that the more natural format for binary data (or UTF-8 encoded text), was std::vector<uint8_t>.
Was/Is is there a special reason for the choice of std::string ?
The text was updated successfully, but these errors were encountered: