Upgrade sha2 to 0.9.3 (#14746)

This commit is contained in:
sakridge
2021-01-22 22:25:22 -08:00
committed by GitHub
parent bf1943e489
commit 191193289f
10 changed files with 136 additions and 40 deletions

View File

@ -44,21 +44,21 @@ chrono = { version = "0.4", optional = true }
curve25519-dalek = { version = "2.1.0", optional = true }
generic-array = { version = "0.14.3", default-features = false, features = ["serde", "more_lengths"], optional = true }
hex = "0.4.2"
hmac = "0.7.0"
hmac = "0.10.1"
itertools = "0.9.0"
lazy_static = "1.4.0"
log = "0.4.11"
memmap2 = { version = "0.1.0", optional = true }
num-derive = "0.3"
num-traits = "0.2"
pbkdf2 = { version = "0.3.0", default-features = false }
pbkdf2 = { version = "0.6.0", default-features = false }
rand = { version = "0.7.0", optional = true }
rand_chacha = { version = "0.2.2", optional = true }
serde = "1.0.112"
serde_bytes = "0.11"
serde_derive = "1.0.103"
serde_json = { version = "1.0.56", optional = true }
sha2 = "0.8.2"
sha2 = "0.9.2"
thiserror = "1.0"
ed25519-dalek = { version = "=1.0.0-pre.4", optional = true }
solana-crate-features = { path = "../crate-features", version = "1.6.0", optional = true }

View File

@ -22,7 +22,7 @@ rustversion = "1.0.3"
serde = "1.0.112"
serde_bytes = "0.11"
serde_derive = "1.0.103"
sha2 = "0.8.2"
sha2 = "0.9.2"
solana-frozen-abi = { path = "../../frozen-abi", version = "1.6.0" }
solana-frozen-abi-macro = { path = "../../frozen-abi/macro", version = "1.6.0" }
solana-sdk-macro = { path = "../macro", version = "1.6.0" }

View File

@ -19,7 +19,7 @@ pub struct Hasher {
impl Hasher {
pub fn hash(&mut self, val: &[u8]) {
self.hasher.input(val);
self.hasher.update(val);
}
pub fn hashv(&mut self, vals: &[&[u8]]) {
for val in vals {
@ -29,7 +29,7 @@ impl Hasher {
pub fn result(self) -> Hash {
// At the time of this writing, the sha2 library is stuck on an old version
// of generic_array (0.9.0). Decouple ourselves with a clone to our version.
Hash(<[u8; HASH_BYTES]>::try_from(self.hasher.result().as_slice()).unwrap())
Hash(<[u8; HASH_BYTES]>::try_from(self.hasher.finalize().as_slice()).unwrap())
}
}

View File

@ -400,7 +400,7 @@ pub fn keypair_from_seed_phrase_and_passphrase(
seed_phrase: &str,
passphrase: &str,
) -> Result<Keypair, Box<dyn error::Error>> {
const PBKDF2_ROUNDS: usize = 2048;
const PBKDF2_ROUNDS: u32 = 2048;
const PBKDF2_BYTES: usize = 64;
let salt = format!("mnemonic{}", passphrase);