-
Notifications
You must be signed in to change notification settings - Fork 731
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
hash_algos() docs should clarify which algos are cryptographic #3616
Comments
Maybe it is sufficient to clarify that |
This would only solve a tiny portion of the problem I was pointing out.
What's really needed is:
|
I’m not sure it’s actually useful information; at least, it’s largely insufficient. For instance, md4 is “cryptographic“, but you shouldn’t use it for anything cryptography-related unless someone holds a gun to your head. |
A common theme in the user-contributed notes for
(I deleted a bunch of the notes on |
I just want to be sure of something here: is the goal of this documentation to talk about the PHP functions and how they work, or is the goal to teach developers about how to implement their own version of cryptography? |
@damianwadley What do you mean by "implement their own version"? I don't think anyone's expecting users to come up with new, novel, hashing algorithms. What I am hoping for is some description beyond a name for the 60 different algorithms currently supported by |
While agree that the current documentation is somewhat insufficient, I wouldn't go too much into the details; perhaps we can find some good article(s) to link to, instead.
A short explantion might be in order, but certainly not a thorough treatment like on https://en.wikipedia.org/wiki/Hash_function or https://en.wikipedia.org/wiki/Cryptographic_hash_function.
ACK
Hmm, maybe some rough categorization might be in order, but detailed explanation about every single algorithm seems out of scope of the PHP manual. Besides, it's already not easy to keep the simple list up to date.
That's difficult. Depending on the use case, MD5 and SHA1 might still be fine (and sometimes just necessary for interoperability with already existing hashes). See https://en.wikipedia.org/wiki/Cryptographic_hash_function#Properties for details.
That's difficult, again. Maybe we could attempt some rough categorization of the available algorithms.
A rough explanation of the performance might make sense, but these benchmarks are pretty useless, in my opinion. After all, some of the algorithms may be implemented with SIMD instructions (but having a fallback if these instructions are not available), and a few even might have hardware support (e.g. php/php-src#4108), and the implementations may even change over time. |
I didn't say "detailed explanation", I said "some description beyond a name". The context being that multiple people are claiming that users should be using the Maybe there are some algorithms that can just be labelled "rarely used, included for compatibility with other systems", but right now we don't even have that. |
I'm not an expert on hash functions, so take the following with a huge grain of salt (and please correct me, if I'm wrong). As I see it, there are roughly three categories of hash functions:
So "usually" this boils down to:
|
Based on this comment by @cmb69: php#3616 (comment) Related to issue php#3616.
Quick note to not forget about it: maybe link to https://csrc.nist.gov/projects/hash-functions (see https://news-web.php.net/php.internals/124678). |
* Add more description for hash extension Based on this comment by @cmb69: #3616 (comment) With additional feedback from @TimWolla
Triggered by https://news-web.php.net/php.internals/124613. Thanks, @IMSoP!
hash_hmac()
has a respective changelog entry:doc-en/reference/hash/functions/hash-hmac.xml
Line 100 in feab22a
I think it's a good idea to also state that in the
hash_algos()
docs.The text was updated successfully, but these errors were encountered: