From 5b35ff475c156ff43d0596ae6f89ab115fc00bf1 Mon Sep 17 00:00:00 2001 From: ayyghost Date: Mon, 18 Nov 2024 17:51:31 +0000 Subject: [PATCH] Clone DH output when mixing with room secret --- js/workers/ecdh.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/workers/ecdh.js b/js/workers/ecdh.js index ea54e0a..6da7eac 100644 --- a/js/workers/ecdh.js +++ b/js/workers/ecdh.js @@ -28,8 +28,7 @@ function genSharedSecret(theirPublicKey, ourPrivateKey, roomSecret) { ) ); // concat the room secret to the hashed DH output, and hash that to get the final shared secret - const mixed = sharedSecret.concat(toWordArray(roomSecret)); - sharedSecret = CryptoJS.SHA512(mixed); + sharedSecret = CryptoJS.SHA512(sharedSecret.clone().concat(toWordArray(roomSecret))); return { message: sharedSecret.words.slice(0, 8),