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

Expose a hashing function that takes byteslices #10

Merged
merged 3 commits into from
May 2, 2023
Merged

Conversation

potuz
Copy link
Collaborator

@potuz potuz commented May 1, 2023

fixes #4

This PR exposes a HashByteSlice function that takes []byte for digests and chunks instead of [][32]byte. It uses an unsafe pointer cast to avoid allocation.

It incurs on a small penalty per call due to slice capacity and size recomputation.

@potuz potuz added the enhancement New feature or request label May 1, 2023
hash.go Show resolved Hide resolved
@potuz
Copy link
Collaborator Author

potuz commented May 1, 2023 via email

@@ -1,7 +1,7 @@
/*
MIT License

Copyright (c) 2021 Prysmatic Labs
# Copyright (c) 2021 Prysmatic Labs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why is my linter doing this change?

Copy link
Member

Choose a reason for hiding this comment

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

🤷

@potuz potuz merged commit aafd8b3 into main May 2, 2023
@delete-merged-branch delete-merged-branch bot deleted the hash_byteslice branch May 2, 2023 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a continous []byte buffer as param for Hash function
4 participants