title: AES decryption fails in forge but works in crypto-js
body: <p>I am decrypting a message string at a regular interval. After studying multiple jsperf's I've noticed forge and stanford are faster than cryptojs - I need that extra speed as I am bound to support older mobile devices, so I'm attempting to migrate.</p>
  
  <p>Here is the working crpto-js code:</p>
  
  <pre><code>var feed = message.data.msg;
  var iv = CryptoJS.enc.Hex.parse(_iv);
  var key = CryptoJS.enc.Hex.parse(_key);
  
  var decrypted = CryptoJS.AES.decrypt(feed.substr(32), key, { iv: iv });
  feed = decrypted.toString(CryptoJS.enc.Utf8);
  </code></pre>
  
  <p>And now the non-working forge code:</p>
  
  <pre><code>var feed = message.data.msg;
  var iv = forge.util.hexToBytes(_iv);
  var key = forge.util.hexToBytes(_key);
  
  var buffer = forge.util.createBuffer( feed.substr(32) );
  var cipher = forge.aes.createDecryptionCipher(key);
  
  cipher.start( iv );
  cipher.update( buffer );
  cipher.finish();
  
  feed = cipher.output.toHex();
  </code></pre>
  
  <p>After decryption with forge I get a random jumble of characters. While stepping through the code, the only thing of note is a failure in forge/aes.js, line 969:</p>
  
  <pre><code>if(count &gt; (Nb &lt;&lt; 2)) {
      rval = false;
  }
  </code></pre>
  
  <p>Is firing and returning false.</p>
  
  <p>I'm at a loss here as both libraries use CBC as the default for AES so everything should just work. </p>