-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Added Sha3 as alternative #2480
Conversation
added commit and added more context to PR description |
Codecov Report
@@ Coverage Diff @@
## master #2480 +/- ##
==========================================
- Coverage 62.92% 62.90% -0.03%
==========================================
Files 162 162
Lines 13981 13985 +4
==========================================
- Hits 8798 8797 -1
- Misses 4496 4498 +2
- Partials 687 690 +3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be precise and explicit, i.e. call the hash function SHA3-256 (or Sha3-256). At the same time, we are applying a hash function, so that should be stated.
To lessen typing load, I would come with opinionated defaults. That's why I still think the default should be
replace: '*SSN*{{ .Value | Hash }}*'
which then offers SHA3-256 & a configured hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edited docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's already been a lot of feedback here and I'm not opinionated enough/think bikeshedding further is worse than committing to something.
I like that we're exposing a Hash
method designed to be kept strong over time. I dislike that we chose Sha2Hash
over Sha256
.
All in all I think this is a great PR I'm excited to have in Loki. Great work @wardbekker.
Co-authored-by: Ed Welch <ed@oqqer.com>
Co-authored-by: Ed Welch <ed@oqqer.com>
What this PR does / why we need it:
PR For discussion. Looking for a nice way to add Sha3_256 as a modern alternative to Sha2_256
Was looking how to I could implement template function syntax like:
But I couldn't find a way to implement function overloading in Go.
Hence, to don't go overboard on verbosity on the template function (e.g.
Hash_Sha3_256(salt, input)
) I settled forSha2(salt, input)
andSha3(salt, input)
.I recommend to use only _256 result:
Checklist