title: AES_encrypt : initialization of one of the variables
body: <p>I have this function that in the first call, is giving me back the Correct Encrypted Value</p>
  <pre><code>120692dbcdca656394fc10147e2418f2
  </code></pre>
  <p>But all that comes after are incorrect :</p>
  <pre><code>764e1a39b43c42f30da2e9e327d4ed22
  b93b46dbc936ae3b06f571ffe1a59cac
  b93b46dbc936ae3b06f571ffe1a59cac
  a71787b35326e282f8c1bf3a0a034620
  </code></pre>
  <p>I'm new with C++ and I think it is a matter of initialization of one of the variables.
  I did many Tests but I'm not able to point out where is the Error.
  Could someone help me please ?
  Thank You -</p>
  <pre><code>#include &lt;openssl/aes.h&gt;
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  
  char* pxEnAndDeCrypt(char* pStr )
  {
      
      static const unsigned char key[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
      char *ptr = NULL;
  
      unsigned char enc_out[80]= {};
      unsigned char dec_out[80]= {};
      
      int i,j,lenHexa ;
      char enc_out_HEXA[200]= {};
      unsigned char enc_out_TRANSF[200]= {};
      unsigned char enc_out_BACK[200]= {};
  
      AES_KEY enc_key, dec_key;
  
          // ENCRYPT :                              Input =*pStr             Output = enc_out
  
          AES_set_encrypt_key(key, 128, &amp;enc_key);
          AES_encrypt((const unsigned char *)pStr, enc_out, &amp;enc_key);  
  
          // TRANSFORM OUTPUT OF ENCRYPT TO HEXA :  Input =enc_out           Output = enc_out_HEXA
  
          int len  = strlen((char*)enc_out);
  
          for (i = 0, j = 0; i &lt; len; ++i, j += 2)
          { 
                sprintf(enc_out_HEXA  + j, &quot;%02x&quot;, enc_out[i] &amp; 0xff);
          }
          ptr = (char *) enc_out_HEXA;
  
  // OUTPUT 
  
      return ptr;
  }
  </code></pre>