-
Notifications
You must be signed in to change notification settings - Fork 41
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
PID-676: support hash interface for poseidon; support golang crypto interfaces… #55
PID-676: support hash interface for poseidon; support golang crypto interfaces… #55
Conversation
babyjub/babyjub_wrapper_test.go
Outdated
require.False(t, x1.Equal(x2)) | ||
} | ||
|
||
func decomrpessSig(commpresedSig []byte) (*Signature, error) { |
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.
Fix name: decompressSig
Also, maybe it makes sense to have it public and in library instead of test?
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.
Done.
I renamed and made this function public.
poseidon/poseidon_wrapper.go
Outdated
|
||
// NewPoseidon returns the Poseidon hash of the input bytes. | ||
// use frame size of 16 inputs by default | ||
func NewPoseidon(b []byte) []byte { |
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.
Name of this function is weird. It's not instantiating new poseidon hasher, it performs hashing instead. I think we don't need it at all.
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.
Take a look at New* functions in https://pkg.go.dev/golang.org/x/crypto/sha3#pkg-index and usage examples. Also we need to test that writing data ('h.Write`) in multiple steps with different input sizes still works.
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.
Done. Sync with x/crypto
and /crypto
libs.
Add unit test of h.Write
in multiple steps.
poseidon/poseidon_wrapper.go
Outdated
return d.buf.Write(p) | ||
} | ||
|
||
// Sum returns the Poseidon checksum of the data. |
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.
not checksum, but hash digest
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.
done
poseidon/poseidon_wrapper.go
Outdated
"hash" | ||
) | ||
|
||
type digest struct { |
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.
It's not a digest
. Need a better name, maybe hasher
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.
done
No description provided.