xmpp-parsers: Bump all hash crates.
This commit is contained in:
parent
edba9c9f5d
commit
1a03588bdb
3 changed files with 19 additions and 19 deletions
|
@ -17,11 +17,11 @@ edition = "2018"
|
|||
minidom = "0.13"
|
||||
jid = { version = "0.9", features = ["minidom"] }
|
||||
base64 = "0.13"
|
||||
digest = "0.9"
|
||||
sha-1 = "0.9"
|
||||
sha2 = "0.9"
|
||||
sha3 = "0.9"
|
||||
blake2 = "0.9"
|
||||
digest = "0.10"
|
||||
sha-1 = "0.10"
|
||||
sha2 = "0.10"
|
||||
sha3 = "0.10"
|
||||
blake2 = "0.10"
|
||||
chrono = { version = "0.4.5", default-features = false, features = ["std"] }
|
||||
|
||||
[features]
|
||||
|
|
|
@ -11,7 +11,7 @@ use crate::ns;
|
|||
use crate::presence::PresencePayload;
|
||||
use crate::util::error::Error;
|
||||
use crate::Element;
|
||||
use blake2::VarBlake2b;
|
||||
use blake2::Blake2bVar;
|
||||
use digest::{Digest, Update, VariableOutput};
|
||||
use sha1::Sha1;
|
||||
use sha2::{Sha256, Sha512};
|
||||
|
@ -187,17 +187,17 @@ pub fn hash_caps(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
|||
get_hash_vec(hash.as_slice())
|
||||
}
|
||||
Algo::Blake2b_256 => {
|
||||
let mut hasher = VarBlake2b::new(32).unwrap();
|
||||
let mut hasher = Blake2bVar::new(32).unwrap();
|
||||
hasher.update(data);
|
||||
let mut vec = Vec::with_capacity(32);
|
||||
hasher.finalize_variable(|slice| vec.extend_from_slice(slice));
|
||||
let mut vec = vec![0u8; 32];
|
||||
hasher.finalize_variable(&mut vec).unwrap();
|
||||
vec
|
||||
}
|
||||
Algo::Blake2b_512 => {
|
||||
let mut hasher = VarBlake2b::new(64).unwrap();
|
||||
let mut hasher = Blake2bVar::new(64).unwrap();
|
||||
hasher.update(data);
|
||||
let mut vec = Vec::with_capacity(64);
|
||||
hasher.finalize_variable(|slice| vec.extend_from_slice(slice));
|
||||
let mut vec = vec![0u8; 64];
|
||||
hasher.finalize_variable(&mut vec).unwrap();
|
||||
vec
|
||||
}
|
||||
Algo::Unknown(algo) => return Err(format!("Unknown algorithm: {}.", algo)),
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::hashes::{Algo, Hash};
|
|||
use crate::ns;
|
||||
use crate::presence::PresencePayload;
|
||||
use crate::util::error::Error;
|
||||
use blake2::VarBlake2b;
|
||||
use blake2::Blake2bVar;
|
||||
use digest::{Digest, Update, VariableOutput};
|
||||
use sha2::{Sha256, Sha512};
|
||||
use sha3::{Sha3_256, Sha3_512};
|
||||
|
@ -146,17 +146,17 @@ pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, Error> {
|
|||
get_hash_vec(hash.as_slice())
|
||||
}
|
||||
Algo::Blake2b_256 => {
|
||||
let mut hasher = VarBlake2b::new(32).unwrap();
|
||||
let mut hasher = Blake2bVar::new(32).unwrap();
|
||||
hasher.update(data);
|
||||
let mut vec = Vec::with_capacity(32);
|
||||
hasher.finalize_variable(|slice| vec.extend_from_slice(slice));
|
||||
let mut vec = vec![0u8; 32];
|
||||
hasher.finalize_variable(&mut vec).unwrap();
|
||||
vec
|
||||
}
|
||||
Algo::Blake2b_512 => {
|
||||
let mut hasher = VarBlake2b::new(64).unwrap();
|
||||
let mut hasher = Blake2bVar::new(64).unwrap();
|
||||
hasher.update(data);
|
||||
let mut vec = Vec::with_capacity(64);
|
||||
hasher.finalize_variable(|slice| vec.extend_from_slice(slice));
|
||||
let mut vec = vec![0u8; 64];
|
||||
hasher.finalize_variable(&mut vec).unwrap();
|
||||
vec
|
||||
}
|
||||
Algo::Sha_1 => return Err(Error::ParseError("Disabled algorithm sha-1: unsafe.")),
|
||||
|
|
Loading…
Reference in a new issue