Documentation cleanup and idiomatic, faster word load/store - #11
Merged
Conversation
- Remove the Go Report Card badge from the README. - Update the copyright email in LICENSE to schultz@sent.com. - Fix "block ciphers modes" -> "block cipher modes" (README, twice). - Correct New1024 doc comment: the key must be 128 bytes, not 64 (copy-paste from New512; the code already enforces 128 via blockSize1024).
- Replace the package-level loadWord/storeWord function-value aliases with direct binary.LittleEndian.Uint64/PutUint64 calls. Assigning stdlib functions to package vars is non-idiomatic, and calling through the variable is an indirect call the compiler cannot inline -- it defeats the single-instruction intrinsic these normally compile to. Removing the indirection is measurably faster (Apple M1 Ultra, Go 1.26): geomean -8.2%, e.g. Threefish1024/encrypt -15.5%, Threefish512/encrypt -10.9%, Threefish256/encrypt -6.5% (256-decrypt is unchanged -- it is dependency-chain bound, not load/store bound). - Add compile-time interface assertions (var _ cipher.Block = (*cipherN)(nil)) documenting and enforcing that each cipher type satisfies crypto/cipher.Block. Behavior is unchanged; the known-answer vectors still pass.
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.
No description provided.