|
|
@ -19,8 +19,8 @@ use sha2::{Digest, Sha512};
|
|
|
|
/// println!("{}", hash(data, salt));
|
|
|
|
/// println!("{}", hash(data, salt));
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
pub fn hash<D: Into<String>, S: Into<String>>(data: D, salt: S) -> String {
|
|
|
|
pub fn hash<D: Into<String>, S: Into<String>>(data: D, salt: S) -> String {
|
|
|
|
let string = salt.into() + &data.into();
|
|
|
|
let s = salt.into() + &data.into();
|
|
|
|
let hash = Sha512::digest(string.as_bytes());
|
|
|
|
let hash = Sha512::digest(s.as_bytes());
|
|
|
|
hash.iter().map(|b| format!("{:02x}", b)).collect()
|
|
|
|
hash.iter().map(|b| format!("{:02x}", b)).collect()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|