title: How to check if the decryption is correct?
body: <p>I'm working on chat room that encrypt messages for more than one users and each user might have different encryption and key/password. The user's key won't work with all the message, therefore; return errors.</p>
  
  <pre><code>var message ="secret message";
  var encrypted = CryptoJS.AES.encrypt(message, "Secret Passphrase");
  try {
      var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase123").toString(CryptoJS.enc.Utf8);
      if (decrypted.length &gt; 0) {
          alert(decrypted);
      } else {
          alert("false");
      }
  } catch(e) {
      alert("false");
  }
  </code></pre>
  
  <p>I'm currently catching the error, but sometimes the decryption returns with jumbled up letters and symbols. The current way I'm doing this is not efficient. Is there a better way?</p>