-
Notifications
You must be signed in to change notification settings - Fork 385
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
feat: sha1.Sum() #570
feat: sha1.Sum() #570
Conversation
Mmh. I have a couple of questions:
|
@@ -0,0 +1,18 @@ | |||
package msha1 |
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.
You can move this test to the stdlibs folder, or you can keep it here and create an official example folder to test the stdlibs. If you choose to keep it here, I suggest moving it outside of the r/
folder. What about gno.land/p/demo/stdlibs_tests
?
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.
Moving test to stdlibs folder looks more straightforward to me. I'll move it
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.
Given the security concerns, it would be best to choose a more secure cryptographic primitive than SHA1. Do you have a specific use case in mind for which you need to use SHA1?
@thehowl @moul I'll move the test case to stdlibs, however I knew about the security concerns(such as collision) so I think it's ok to block this pr |
Hey @thehowl this is thing I wanted to discuss with someone else. Before we continue I just want make sure that terms of If we just take But I'm sure there will be more function that we need in Gno that works same as in Go, and if certain package has complex structure copying code seems lots of work to do. There will be pros and cons to use injection and I think it is good topics to discuss. |
On the selection of algorithms, it deserves a more open discussion, and it would be nice to have experts helping us. |
if arg0.V != nil { | ||
slice := arg0.V.(*gno.SliceValue) | ||
array := slice.GetBase(m.Store) | ||
bz = array.GetReadonlyBytes() |
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.
Please consider using
bz = array.GetReadonlyBytes()[:slice.Length]
The function GetReadonlyBytes()
could return leading 0
in the bytes array.
We will not be adding the deprecated SHA1 and instead opt to add other versions, as suggested in #580. |
Description
calculate sha1 hash of given data
How has this been tested?
tests by gnodev