-
Notifications
You must be signed in to change notification settings - Fork 39
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
Switch from sha256 to keccak256 #23
Conversation
@@ -43,7 +43,7 @@ impl Provider { | |||
pub(super) fn test() -> Provider { | |||
Self::Split( | |||
SplitProvider { | |||
builder: sha2::Sha256::new().chain("Lzr81nDW8eSOMH".as_bytes()), | |||
builder: sha3::Keccak256::new().chain("Lzr81nDW8eSOMH".as_bytes()), |
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.
this has nothing to do with evm. Is keccak faster than sha?
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.
Depends. On hardware implementations Keccak/SHA3 is faster, but if there's no hardware support then it's slower than SHA2.
That being said, I just think it's easier for now to just use one hash algorithm for everything. If/when we do code profiling and realize that hashing is a bottleneck, we can change to a faster algorithm like BLAKE3 wherever we can.
|
||
mod test; | ||
pub mod testonly; |
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.
Off-topic (?): Why does this module need to be public? AFAICT, it doesn't contain public items.
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 sure if you refer to line 5 (added) or 6 (already exists).
testonly
: it needs to be public, although it works without the pub modifier, because visibility is bound to the trait implementation target type.test
: I forgot to add the#[cfg(test)]
attribute. Added now.
6e562ac
# Conflicts: # node/Cargo.lock # node/actors/network/src/noise/stream.rs # node/deny.toml # node/libs/crypto/src/keccak256/mod.rs # node/libs/crypto/src/lib.rs # node/libs/roles/src/node/messages.rs # node/libs/roles/src/validator/messages/block.rs # node/libs/roles/src/validator/messages/msg.rs
Switching from sha256 to keccak256 as the general-purpose hash function, to enhance compatibility with EVM/zkEVM.
Closing BFT-361.