-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
bot merge |
Trying merge. |
@@ -146,6 +146,15 @@ pub fn keccak_256(data: &[u8]) -> [u8; 32] { | |||
output | |||
} | |||
|
|||
/// Do a keccak 512-bit hash and return result. | |||
pub fn keccak_512(data: &[u8]) -> [u8; 64] { |
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.
Shouldn't this be exposed as a host function (sp_io
)? If someone uses sp_core::hashing::keccak_512
it will compute the hash in the WASM instead.
CC @pepyakin
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.
yeah, for getting native implementations one would need to put them under Hashing
runtime interface in sp_io.
But this case is rather confusing, that implies that one needs to know to use sp_io
instead of sp_core
versions.
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.
Well if you look at other functions in sp_io::hashing
host-side implementation it actually delegates to sp_core::hashing
, so the entire file seems a bit confusing for me, cause it's in theory it should never be used in runtime directly, yet the crate compiles just fine and we jut rely on developers to use the correct stuff.
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.
Update: sp_core::hashing
is gated under full-crypto
, but I think it still deserves a bit more documentation.
No description provided.