-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use crypto-hash to calculate SHA256 #4542
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@alexcrichton could we use a pure rust crate for SHA256 calculations? It seems like there's little reason to use native libraries for hashes specifically. |
I believe https://github.com/RustCrypto/hashes computes sha256 natively. |
Since I made this PR to reduce OpenSSL dependency on macOS, pure-rust implementation is also fine to me. |
Thanks for the PR! It seems like the only major change here though is to not use OpenSSL on OSX? I think that we still have to pull it in anyway because of libssh2, right? |
@alexcrichton Yes, we'll still need OpenSSL for libssh2, but I want this change so that we can remove OpenSSL dependency on macOS once libssh2 supports macOS' Security Framework in future. |
@alexcrichton How do you think about pure-rust implementation for SHA256? |
@equal-l2 let's not wait on alexcrichton and just use the |
@matklad OK, then should I do that in new PR? |
You can create a new PR, or force push this one, either is fine! |
Then I will create a new PR soon. |
Created new PR |
@bors: r+ |
📌 Commit 8346104 has been approved by |
Use crypto-hash to calculate SHA256 `crypto-hash` is an abstraction library for native hash libraries. It uses CryptoAPI on Windows, CommonCrypto on macOS, and OpenSSL on *nix. This PR will also remove `openssl` and `advapi32-sys` from dependencies since they are only used for calculating SHA256, which is superseded by `crypto-hash`. (`crypto-hash` itself uses `openssl` and `advapi32-sys` though)
☀️ Test successful - status-appveyor, status-travis |
crypto-hash
is an abstraction library for native hash libraries.It uses CryptoAPI on Windows, CommonCrypto on macOS, and OpenSSL on *nix.
This PR will also remove
openssl
andadvapi32-sys
from dependencies since they are only used for calculating SHA256, which is superseded bycrypto-hash
.(
crypto-hash
itself usesopenssl
andadvapi32-sys
though)