Skip to content

Simplify cross-platform hashing implementations #388

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

owenv
Copy link
Collaborator

@owenv owenv commented Apr 9, 2025

Eliminate the package dependency on swift-crypto to simplify the bootstrapped build. Instead, vendor the SHA256 implementation from swift-tools-support-core and use it as a fallback if neither WinSDK nor CryptoKit is available.

@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test

@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test macOS

@owenv owenv force-pushed the owenv/simplify-hashing branch from 6bbc242 to 52b4ae3 Compare April 9, 2025 18:00
@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test

@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test linux

@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test Windows

@owenv owenv force-pushed the owenv/simplify-hashing branch from 52b4ae3 to 03eed0b Compare April 9, 2025 19:23
@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test

@owenv owenv force-pushed the owenv/simplify-hashing branch from 03eed0b to 9a2d662 Compare April 9, 2025 19:37
@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test

super.init(impl: SwiftCryptoHashContext<Insecure.MD5>())
#else
super.init(impl: VendoredSHA256HashContext())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little shaky to use MD5 on Windows and Apple but SHA256 on other platforms. Do you plan to unify this further? I'm even surprised the tests pass like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably standardize on SHA256 everywhere in the future. Very few tests actually depend on the specific hash values, it's just important that they remain stable across builds performed by the same build system executable

Eliminate the package dependency on swift-crypto to simplify the bootstrapped build. Instead, vendor
the SHA256 implementation from swift-tools-support-core and use it as a fallback if neither WinSDK nor
CryptoKit is available.
@owenv owenv force-pushed the owenv/simplify-hashing branch from 9a2d662 to 4e3949f Compare April 9, 2025 21:55
@owenv
Copy link
Collaborator Author

owenv commented Apr 9, 2025

@swift-ci test

@owenv owenv merged commit 7319148 into main Apr 9, 2025
3 checks passed
@owenv owenv deleted the owenv/simplify-hashing branch April 9, 2025 23:06
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.

2 participants