Update all crypto crates to their latest release; un-break blake2b.
This commit is contained in:
parent
8aa51bd047
commit
c1ff291c11
4 changed files with 9 additions and 15 deletions
10
Cargo.toml
10
Cargo.toml
|
@ -16,11 +16,11 @@ license = "MPL-2.0"
|
||||||
minidom = "0.6.2"
|
minidom = "0.6.2"
|
||||||
jid = { version = "0.3.1", features = ["minidom"] }
|
jid = { version = "0.3.1", features = ["minidom"] }
|
||||||
base64 = "0.7.0"
|
base64 = "0.7.0"
|
||||||
digest = "0.6.0"
|
digest = "0.7.1"
|
||||||
sha-1 = "0.4.0"
|
sha-1 = "0.7.0"
|
||||||
sha2 = "0.6.0"
|
sha2 = "0.7.0"
|
||||||
sha3 = "0.6.0"
|
sha3 = "0.7.0"
|
||||||
blake2 = "0.6.1"
|
blake2 = "0.7.0"
|
||||||
chrono = "0.4.0"
|
chrono = "0.4.0"
|
||||||
try_from = "0.2.2"
|
try_from = "0.2.2"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use ns;
|
||||||
use base64;
|
use base64;
|
||||||
|
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
use sha_1::Sha1;
|
use sha1::Sha1;
|
||||||
use sha2::{Sha256, Sha512};
|
use sha2::{Sha256, Sha512};
|
||||||
use sha3::{Sha3_256, Sha3_512};
|
use sha3::{Sha3_256, Sha3_512};
|
||||||
//use blake2::Blake2b;
|
//use blake2::Blake2b;
|
||||||
|
|
|
@ -15,11 +15,10 @@ use error::Error;
|
||||||
use ns;
|
use ns;
|
||||||
use base64;
|
use base64;
|
||||||
|
|
||||||
use digest::Digest;
|
|
||||||
use sha2::{Sha256, Sha512};
|
use sha2::{Sha256, Sha512};
|
||||||
use sha3::{Sha3_256, Sha3_512};
|
use sha3::{Sha3_256, Sha3_512};
|
||||||
//use blake2::Blake2b;
|
use blake2::Blake2b;
|
||||||
//use digest::{Digest, VariableOutput};
|
use digest::{Digest, VariableOutput};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ECaps2 {
|
pub struct ECaps2 {
|
||||||
|
@ -144,9 +143,6 @@ pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
||||||
let hash = hasher.result();
|
let hash = hasher.result();
|
||||||
get_hash_vec(hash.as_slice())
|
get_hash_vec(hash.as_slice())
|
||||||
},
|
},
|
||||||
Algo::Blake2b_256
|
|
||||||
| Algo::Blake2b_512 => panic!("See https://github.com/RustCrypto/hashes/issues/34"),
|
|
||||||
/*
|
|
||||||
Algo::Blake2b_256 => {
|
Algo::Blake2b_256 => {
|
||||||
let mut hasher = Blake2b::default();
|
let mut hasher = Blake2b::default();
|
||||||
hasher.input(data);
|
hasher.input(data);
|
||||||
|
@ -161,7 +157,6 @@ pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
||||||
let hash = hasher.variable_result(&mut buf).unwrap();
|
let hash = hasher.variable_result(&mut buf).unwrap();
|
||||||
get_hash_vec(hash)
|
get_hash_vec(hash)
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
Algo::Sha_1 => return Err(String::from("Disabled algorithm sha-1: unsafe.")),
|
Algo::Sha_1 => return Err(String::from("Disabled algorithm sha-1: unsafe.")),
|
||||||
Algo::Unknown(algo) => return Err(format!("Unknown algorithm: {}.", algo)),
|
Algo::Unknown(algo) => return Err(format!("Unknown algorithm: {}.", algo)),
|
||||||
},
|
},
|
||||||
|
@ -452,7 +447,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
|
||||||
fn test_blake2b_512() {
|
fn test_blake2b_512() {
|
||||||
let hash = ecaps2::hash_ecaps2("abc".as_bytes(), Algo::Blake2b_512).unwrap();
|
let hash = ecaps2::hash_ecaps2("abc".as_bytes(), Algo::Blake2b_512).unwrap();
|
||||||
let known_hash: Vec<u8> = vec!(
|
let known_hash: Vec<u8> = vec!(
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern crate minidom;
|
||||||
extern crate jid;
|
extern crate jid;
|
||||||
extern crate base64;
|
extern crate base64;
|
||||||
extern crate digest;
|
extern crate digest;
|
||||||
extern crate sha_1;
|
extern crate sha1;
|
||||||
extern crate sha2;
|
extern crate sha2;
|
||||||
extern crate sha3;
|
extern crate sha3;
|
||||||
extern crate blake2;
|
extern crate blake2;
|
||||||
|
|
Loading…
Reference in a new issue