Skip to content

Commit

Permalink
Clone DH output when mixing with room secret
Browse files Browse the repository at this point in the history
  • Loading branch information
ayyghost committed Nov 18, 2024
1 parent 3d96fb7 commit 5b35ff4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions js/workers/ecdh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 5b35ff4

Please sign in to comment.