drop md5 crate dependency

we already depend on openssl which also provides md5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-11-14 11:19:43 +01:00
parent f569acc5e2
commit c5946faffd
2 changed files with 8 additions and 3 deletions

View File

@ -22,7 +22,6 @@ hyper = { version = "0.13.0-alpha.1" }
lazy_static = "1.3"
libc = "0.2"
log = "0.4"
md5 = "0.6"
mio = "0.6"
native-tls = "0.2"
nix = "0.15"

View File

@ -13,6 +13,7 @@ use std::time::Duration;
use failure::*;
use serde_json::Value;
use openssl::hash::{hash, DigestBytes, MessageDigest};
use proxmox::tools::vec;
@ -385,13 +386,18 @@ where
Ok(())
}
/// Shortcut for md5 sums.
pub fn md5sum(data: &[u8]) -> Result<DigestBytes, Error> {
hash(MessageDigest::md5(), data).map_err(Error::from)
}
pub fn get_hardware_address() -> Result<String, Error> {
static FILENAME: &str = "/etc/ssh/ssh_host_rsa_key.pub";
let contents = proxmox::tools::fs::file_get_contents(FILENAME)?;
let digest = md5::compute(contents);
let digest = md5sum(&contents)?;
Ok(format!("{:0x}", digest))
Ok(proxmox::tools::bin_to_hex(&digest))
}
pub fn assert_if_modified(digest1: &str, digest2: &str) -> Result<(), Error> {