Skip to content
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

Merged
merged 5 commits into from
May 30, 2023

Conversation

ilya-korotya
Copy link
Contributor

@ilya-korotya ilya-korotya commented May 9, 2023

No description provided.

require.False(t, x1.Equal(x2))
}

func decomrpessSig(commpresedSig []byte) (*Signature, error) {
Copy link
Member

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?

Copy link
Contributor Author

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.


// NewPoseidon returns the Poseidon hash of the input bytes.
// use frame size of 16 inputs by default
func NewPoseidon(b []byte) []byte {
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

return d.buf.Write(p)
}

// Sum returns the Poseidon checksum of the data.
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"hash"
)

type digest struct {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ilya-korotya ilya-korotya merged commit 3fb23d7 into master May 30, 2023
@ilya-korotya ilya-korotya deleted the feature/PID-676-support-golang-interfaces branch May 30, 2023 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants