Skip to content
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 sha2 to calculate SHA256 #4545

Closed
wants to merge 1 commit into from
Closed

Use sha2 to calculate SHA256 #4545

wants to merge 1 commit into from

Conversation

equal-l2
Copy link
Contributor

@equal-l2 equal-l2 commented Sep 28, 2017

Supersedes #4542.

This PR will replace FFI libraries for SHA256 calculation with pure-rust implementation.
openssl and advapi32-sys will be removed from dependencies since they are only used for calculating SHA256.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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
Copy link
Member

Thanks again for the PR! Sorry I didn't quite have enough time to respond on #4542, but I wonder if it'd be possible to just vendor an implementation using common crypto on OSX? I'm somewhat hesitant to move to a Rust-based solution just yet when we've got other crypto libraries in the binary doing it already :(

@equal-l2
Copy link
Contributor Author

@alexcrichton
I think #4542 is suitable then.
crypto-hash should provide same functionality as current implementation using native crypto libraries including CommonCrypto.
(CommonCrypto support can be implemented with rust-commoncrypto(by crypto-hash's author) if you want, though)

CC: @matklad

@alexcrichton
Copy link
Member

It looks like crypto-hash was mostly just a thin layer over what we're already doing, so it seems fine by me to include it. One less thing to worry about depending on openssl!

@matklad
Copy link
Member

matklad commented Sep 28, 2017

I'm somewhat hesitant to move to a Rust-based solution just yet when we've got other crypto libraries in the binary doing it already :(

Rustup uses both ssh2 crate and openssl, so it's fine with me to do the same and just include ssh and suffer a small increase in binary size for the sake of "one more pure Rust thing" (esp. given that ssh2 is small, because it's only hash functions). But yeah, saving a couple of bytes is a nice thing too, so I am fine either way :)

I definitely want to get rid of manual implementation inside the Cargo itself though! :)

@equal-l2
Copy link
Contributor Author

I've reopened #4542.

@alexcrichton
Copy link
Member

Ok I'm gonna close this in favor of #4542, thanks @equal-l2!

@equal-l2 equal-l2 deleted the sha256-rustcrypto-sha2 branch October 1, 2017 07:43
bors added a commit that referenced this pull request Mar 4, 2023
Use sha2 to calculate SHA256

crypto-hash seems to be unmaintained (last real commit on Feb 27, 2020) and forces duplicate crates due to outdated dependencies.

Minimal change to replace crypto-hash by sha2.

This was already attempted in #4545 (back in 2017).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants