mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
sp-core-hashing: use the digest::Digest trait to handle the hashing function uniformly (#10835)
* sp-core-hashing: use sha3 instead of tiny-keccak Signed-off-by: koushiro <koushiro.cqx@gmail.com> * use blake2 instead of blake2-rfc Signed-off-by: koushiro <koushiro.cqx@gmail.com> * improve som hashing of sp-core and sp-api-proc-macro Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Some nits Signed-off-by: koushiro <koushiro.cqx@gmail.com> * cargo fmt Signed-off-by: koushiro <koushiro.cqx@gmail.com>
This commit is contained in:
@@ -39,8 +39,6 @@ use syn::{
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use blake2_rfc;
|
||||
|
||||
/// The ident used for the block generic parameter.
|
||||
const BLOCK_GENERIC_IDENT: &str = "Block";
|
||||
|
||||
@@ -750,8 +748,10 @@ fn parse_runtime_api_version(version: &Attribute) -> Result<u64> {
|
||||
/// Generates the identifier as const variable for the given `trait_name`
|
||||
/// by hashing the `trait_name`.
|
||||
fn generate_runtime_api_id(trait_name: &str) -> TokenStream {
|
||||
use blake2::digest::{consts::U8, Digest};
|
||||
|
||||
let mut res = [0; 8];
|
||||
res.copy_from_slice(blake2_rfc::blake2b::blake2b(8, &[], trait_name.as_bytes()).as_bytes());
|
||||
res.copy_from_slice(blake2::Blake2b::<U8>::digest(trait_name).as_slice());
|
||||
|
||||
quote!( const ID: [u8; 8] = [ #( #res ),* ]; )
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user