Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a new gsha256 package that provides SHA256 hashing utilities for arbitrary data and file contents, following the established patterns in GoFrame's crypto packages (gsha1, gmd5). The implementation includes core hashing functions and comprehensive unit tests.
- Added three main functions:
Encrypt,EncryptFile, andMustEncryptFilefor SHA256 hashing - Included unit tests covering string/struct hashing and file hashing scenarios
- Followed consistent patterns with existing crypto packages in the codebase
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| crypto/gsha256/gsha256.go | Implements the core SHA256 hashing functions with proper error handling and wrapping |
| crypto/gsha256/gsha256_z_unit_test.go | Provides unit tests for the Encrypt and EncryptFile functions with edge case coverage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…le (#4560) Updates #4558 Function comments in `gsha256` used lowercase "sha256 algorithms" while sibling packages `gsha1` and `gmd5` use uppercase "SHA1 algorithms" and "MD5 algorithms". **Changes:** - Capitalized "SHA256" in all function comments (`Encrypt`, `EncryptFile`, `MustEncryptFile`) This maintains consistency with the existing documentation style across crypto packages. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joy999 <5414344+joy999@users.noreply.github.com> Co-authored-by: Hunk Zhu <54zhua@gmail.com>
gqcn
approved these changes
Dec 11, 2025
Member
|
/lgtm |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new package,
gsha256, providing SHA256 encryption utilities for both arbitrary data and file contents. It also adds comprehensive unit tests to ensure the correctness of these new APIs.New SHA256 encryption utilities:
gsha256package with three main functions:Encrypt: Hashes any variable using SHA256, converting input to bytes viagconv.EncryptFile: Hashes the contents of a file at a given path, returning the SHA256 digest as a hex string. Errors are wrapped for clarity.MustEncryptFile: LikeEncryptFile, but panics on error for convenience in situations where failure is unexpected.Unit tests for new functionality:
gsha256_z_unit_test.goto test the new APIs:Encrypt.EncryptFile.