From 6b4cc36c606abb39a4c76b5d3f8923a3ec7085a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Jan 2021 11:58:26 +0000 Subject: [PATCH] Bump sha2 from 0.8.2 to 0.9.2 (#7643) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump sha2 from 0.8.2 to 0.9.2 Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.8.2 to 0.9.2. - [Release notes](https://github.com/RustCrypto/hashes/releases) - [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.8.2...streebog-v0.9.2) Signed-off-by: dependabot[bot] * Fix compilation error Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bastian Köcher --- substrate/Cargo.lock | 2 +- substrate/primitives/core/Cargo.toml | 2 +- substrate/primitives/core/src/hashing.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 871b0f60d7..6e7c108582 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -8338,7 +8338,7 @@ dependencies = [ "secrecy", "serde", "serde_json", - "sha2 0.8.2", + "sha2 0.9.2", "sp-debug-derive", "sp-externalities", "sp-runtime-interface", diff --git a/substrate/primitives/core/Cargo.toml b/substrate/primitives/core/Cargo.toml index de06ecd87e..50c57e068d 100644 --- a/substrate/primitives/core/Cargo.toml +++ b/substrate/primitives/core/Cargo.toml @@ -46,7 +46,7 @@ ed25519-dalek = { version = "1.0.1", default-features = false, features = ["u64_ blake2-rfc = { version = "0.2.18", default-features = false, optional = true } tiny-keccak = { version = "2.0.1", features = ["keccak"], optional = true } schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false, optional = true } -sha2 = { version = "0.8.0", default-features = false, optional = true } +sha2 = { version = "0.9.2", default-features = false, optional = true } hex = { version = "0.4", default-features = false, optional = true } twox-hash = { version = "1.5.0", default-features = false, optional = true } libsecp256k1 = { version = "0.3.2", default-features = false, features = ["hmac"], optional = true } diff --git a/substrate/primitives/core/src/hashing.rs b/substrate/primitives/core/src/hashing.rs index 8a4c5191dd..0b67d33235 100644 --- a/substrate/primitives/core/src/hashing.rs +++ b/substrate/primitives/core/src/hashing.rs @@ -77,7 +77,7 @@ pub fn blake2_64(data: &[u8]) -> [u8; 8] { /// Do a XX 64-bit hash and place result in `dest`. pub fn twox_64_into(data: &[u8], dest: &mut [u8; 8]) { - use ::core::hash::Hasher; + use core::hash::Hasher; let mut h0 = twox_hash::XxHash::with_seed(0); h0.write(data); let r0 = h0.finish(); @@ -94,7 +94,7 @@ pub fn twox_64(data: &[u8]) -> [u8; 8] { /// Do a XX 128-bit hash and place result in `dest`. pub fn twox_128_into(data: &[u8], dest: &mut [u8; 16]) { - use ::core::hash::Hasher; + use core::hash::Hasher; let mut h0 = twox_hash::XxHash::with_seed(0); let mut h1 = twox_hash::XxHash::with_seed(1); h0.write(data); @@ -163,8 +163,8 @@ pub fn keccak_512(data: &[u8]) -> [u8; 64] { /// Do a sha2 256-bit hash and return result. pub fn sha2_256(data: &[u8]) -> [u8; 32] { let mut hasher = Sha256::new(); - hasher.input(data); + hasher.update(data); let mut output = [0u8; 32]; - output.copy_from_slice(&hasher.result()); + output.copy_from_slice(&hasher.finalize()); output }