title: ColdFusion decrypt encodings are not the same
body: <p>I am trying to decrypt a string using ColdFusion's <code>Decrypt()</code> function, but am getting an "encodings are not the same..." error.  </p>
  
  <p>These are the steps I was instructed to take from the string's source:</p>
  
  <ol>
  <li>Create an MD5 hash of the shared key</li>
  <li>Using TripeDES with the cipher of ECB, decrypt the encrypted string with the MD5 hash of the shared key</li>
  </ol>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>&lt;cfset qKey = hash('shared_key','MD5') /&gt;
  &lt;cfset dc = Decrypt('string_to_decrypt', qkey, 'DESEDE/ECB/PKCS5Padding', 'Base64') /&gt;
  &lt;cfdump var="#dc#"&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same.</p>
  </blockquote>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>Also tried the following, but it throws the same error:</p>
  
  <pre><code>&lt;cfset finalText   = "WVJrOdkntkQ%3d"&gt;
  &lt;cfset theKey      = "S3C016" /&gt;
  &lt;cfset theKeyInBase64 = toBase64(theKey)&gt;
  &lt;cfset hashedKey   = hash( theKeyInBase64, "md5" ) /&gt;
  &lt;cfset padBytes    = left( hashedKey, 16 ) /&gt;
  
  &lt;cfset keyBytes    = binaryDecode( hashedKey &amp; padBytes , "hex" ) /&gt;
  &lt;cfset finalKey    = binaryEncode( keyBytes, "base64" ) /&gt;
  &lt;cfset decrypted  = decrypt( finalText, finalKey, "DESede/ECB/PKCS5Padding", "base64" ) /&gt;
  
  Decrypted String: &lt;cfdump var="#decrypted#"&gt;  
  </code></pre>