Encrypt() is resulting in a character that is being stripped by the use of trim(). It looks like a whitespace/CR/etc. using the example CC#.
If you want to trim the input, do it upfront on the cc value itself, then go into the encrypt/decrypt routine. There's no need to trim the result of encrypt or decrypt, as you may be changing the value. <cfoutput> <cfset key = "0XXXXX44po5"> <cfset tt = "4000000000000003"> <cfset tt = trim(tt)> <P>Orig: #tt#</P> <cfset encryptCC = encrypt(tt, key)> <P>Encrypted: #encryptCC#</P> <cfset ccnumber = decrypt(encryptCC, key)> <P>Decrypted: #ccnumber#</P> </cfoutput> Rob -----Original Message----- From: Jacob [mailto:[EMAIL PROTECTED] Sent: Thursday, July 19, 2007 2:49 PM To: CF-Talk Subject: Problems with encrypt and decrypt I am playing around with encrypt and decrypt in CF and I ran into a issue. First, here is the code: <cfoutput> <cfset key = "XXXXX44po"> <cfset tt = "4000000000000003"> <cfset encryptCC = '#trim(encrypt(trim(tt), key))#'> <P>#tt#</P> <P>#encryptCC# </P> <cfset ccnumber = "#trim(decrypt(trim(encryptCC), key))#"> <P>#ccnumber# </P> </cfoutput> When I run this, the decrypt is 4000000000000002. If I change the number to be encrypted, sometimes it decrypts correctly and sometimes it does not. The same is true if I change the key. Any ideas? Thanks Jacob ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284150 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

