Repository navigation
Compute the Blowfish tables from pi, so the package is MIT only - #1
Merged
Merged
Conversation
…age as MIT only BlowfishConstants.cs was copied from Go's golang.org/x/crypto (BSD-3-Clause), which made the package "MIT AND BSD-3-Clause". A source generator now computes the same 1,042 words from pi (Machin's formula in exact fixed point) while the library compiles, so no copied code remains: the copied file and THIRD-PARTY-NOTICES.md are gone and the package is MIT. The generated tables are identical to the copied ones, and the shipped code is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BlowfishConstants.cswas copied from Go'sgolang.org/x/cryptoand carried its BSD-3-Clause licence, so 1.0.0 is licensed "MIT AND BSD-3-Clause". This replaces the copied file with numbers computed at compile time, so every line in the package is our own and it is licensed MIT only.What changed
BlowfishTablesGenerator(in the existing generator project) computes pi's fractional hex digits with Machin's formula, pi = 16 atan(1/5) − 4 atan(1/239), in exactBigIntegerfixed point with 64 guard bits, and writesBlowfishConstants.g.cs: the 18-word P-array and the 1,024-word S-boxes. It runs in about 80 ms per build.BlowfishConstants.csandTHIRD-PARTY-NOTICES.md;PackageLicenseExpressionisMIT;LICENSEand the README's licence section updated.Nothing changes at run time: the DLL holds the same constant tables, so speed, results and allocations are the same.
How it was tested
BlowfishTablesAreTheDigitsOfPipins the table sizes and Schneier's first and last values.licenseisMIT, no notices file, net8.0/net9.0/net10.0 assemblies.Need help on this PR? Tag
@codesmith-botwith what you need.