crypto: Use the chain method to get the sha hash of the content

This commit is contained in:
Damir Jelić 2021-01-14 13:34:12 +01:00
parent 3f3ae794a4
commit 43ea9a16a0

View file

@ -63,10 +63,12 @@ pub struct SasIds {
/// interactive verification process.
pub fn calculate_commitment(public_key: &str, content: impl Into<StartContent>) -> String {
let content = content.into().canonical_json();
let content_string = content.to_string();
encode(
Sha256::new()
.chain(&format!("{}{}", public_key, content))
.chain(&public_key)
.chain(&content_string)
.finalize(),
)
}