ecaps2: Avoid a useless clone.
This commit is contained in:
parent
bbdf38d58b
commit
f18043231c
1 changed files with 1 additions and 1 deletions
|
@ -120,7 +120,6 @@ pub fn compute_disco(disco: &Disco) -> Vec<u8> {
|
||||||
|
|
||||||
pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
||||||
Ok(Hash {
|
Ok(Hash {
|
||||||
algo: algo.clone(),
|
|
||||||
hash: match algo {
|
hash: match algo {
|
||||||
Algo::Sha_256 => {
|
Algo::Sha_256 => {
|
||||||
let mut hasher = Sha256::default();
|
let mut hasher = Sha256::default();
|
||||||
|
@ -163,6 +162,7 @@ pub fn hash_ecaps2(data: &[u8], algo: Algo) -> Result<Hash, String> {
|
||||||
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)),
|
||||||
},
|
},
|
||||||
|
algo: algo,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue