-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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
proposal: crypto, hash: add WriteString support #14757
Comments
And see CL 20524 for a place this would get used. |
Initial CL submitted. I expect it's not quite there yet; glad to make any changes necessary. |
CL https://golang.org/cl/22422 mentions this issue. |
My thought on this issue:
If you want high performance hashing, then using strings
is very probable already a mistake (the string must come
from somewhere else, so it gets converted from []byte in
the first place.) But if the string does not come from outside
(I/O), then it's still better to use []byte directly.
Could you please given a real scenarios where you want
WriteString support on a crypto.Hash while still care about
the utmost performance?
While I agree that WriteString support on io.MultiWriter is fine,
adding WriteString support to all io.Writer implementations
doesn't look necessary esp. if doesn't bring enough
performance improvement.
|
I think you're probably right. Before abandoning this, I'd like to do a bit of research in my Go corpus, but that might take a while. |
Having WriteString might indirectly suggest using it to hash passwords, which is a very, very bad idea. |
I am very skeptical of an unsafe implementation of WriteString here. |
Based on the discussion above (and the general lack of interest over 4 years), this seems like a likely decline. Leaving open for a week for final comments. |
No change in consensus, so declined. |
Add WriteString to crypto/sha1, crypto/sha256, hash/crc64, etc. Similar to #11805. Probably easy pickings.
The text was updated successfully, but these errors were encountered: