From 43ea9a16a0d66870855255b50291f0c464270ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 14 Jan 2021 13:34:12 +0100 Subject: [PATCH] crypto: Use the chain method to get the sha hash of the content --- matrix_sdk_crypto/src/verification/sas/helpers.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix_sdk_crypto/src/verification/sas/helpers.rs b/matrix_sdk_crypto/src/verification/sas/helpers.rs index 248c3a28..617a9827 100644 --- a/matrix_sdk_crypto/src/verification/sas/helpers.rs +++ b/matrix_sdk_crypto/src/verification/sas/helpers.rs @@ -63,10 +63,12 @@ pub struct SasIds { /// interactive verification process. pub fn calculate_commitment(public_key: &str, content: impl Into) -> 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(), ) }