title: I cannot decrypt message encrypted in cryptojs, whose encryption was done in xycrypto, what will be the problem?
body: <p>I am doing an exercise where I must encrypt with 3DES with OFB with some python library, in my case use xycrypto (<a href="https://pypi.org/project/xycrypto/" rel="nofollow noreferrer">https://pypi.org/project/xycrypto/</a>):</p>
  <pre><code>import base64
  from xycrypto.ciphers import TripleDES_OFB
  
  key = b'2ndl38aj2nk3l47d'
  iv = b'pwler1o2'
  plaintext = b'SupErCaliFRAGIlisTICOESpirALiDOso'
  cipher = TripleDES_OFB(key, iv=iv)
  msg = cipher.encrypt(plaintext)
  
  dex = cipher.decrypt(base64.b64decode('HOQOSp3XKCe85sS6/5VMVuyM8lae5lmpqkMYlVm1Gxg/'))
  print(dex)
  msgF = '&quot;'+base64.b64encode(msg).decode('utf-8')+'&quot;'
  keyF = '&quot;'+key.decode('utf-8')+'&quot;'
  ivF = '&quot;'+iv.decode('utf-8')+'&quot;'
  print(msgF)
  html = open('../index.html','w')
  mensaje = &quot;&quot;&quot;&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;es&quot; style=&quot;background-color: black; color: white;&quot;&gt;
      &lt;head&gt;
          &lt;meta charset=&quot;UTF-8&quot;&gt;
          &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
              &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
          &lt;title&gt;Tarea 3 Criptografia y seguridad en redes&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;p&gt;Este sitio contiene un mensaje secreto&lt;/p&gt;
          &lt;div class=&quot;algorithm&quot; id=&quot;&quot;&quot;+msgF+&quot;&quot;&quot;&gt;&lt;/div&gt;
          &lt;div class=&quot;iv&quot; id=&quot;&quot;&quot;+ivF+&quot;&quot;&quot;&gt;&lt;/div&gt;
          &lt;div class=&quot;key&quot; id=&quot;&quot;&quot;+keyF+&quot;&quot;&quot;&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  &quot;&quot;&quot;
  html.write(mensaje)
  html.close()
  </code></pre>
  <p>Create an HTML whose tags contain the encrypted text, the key and the iv, finally, as required by the exercise, I must take the values with JS and tampermonkey, the plugin code is as follows:</p>
  <pre><code>(function decryptTripleDES() {
      'use strict'
      var html = document.getElementsByClassName(&quot;algorithm&quot;);
      var html2 = document.getElementsByClassName(&quot;iv&quot;);
      var html3 = document.getElementsByClassName(&quot;key&quot;);
      var ciphertext = html[0].id
      var key = html3[0].id;
      var iv = html2[0].id;
      var hexK = CryptoJS.enc.Hex.parse(key);
      var hexI = CryptoJS.enc.Hex.parse(iv);
      var decrypted = CryptoJS.TripleDES.decrypt(ciphertext, hexK, {
        iv: hexI,
        mode: CryptoJS.mode.OFB
      });
      alert(decrypted.toString(CryptoJS.enc.Utf8))
  })();
  </code></pre>
  <p>The plugin imports the cryptojs library, calling the decrypt function of 3DES and OFB, I import the html parameters and try to decrypt the content and try to display it with alert, but it returns empty. Am I doing something wrong? It occurs to me that in JS I don't do the base changes correctly with the input parameters but I'm not sure.</p>
  <p>PD: I also tried changing the python library to PyCryptodome but got the same results.</p>