Hi all, I am trying to store specific data into a database in an encrypted 
format. This data also has to be decrypted so as to be displayed and edited 
onscreen therefore ruling out using the hash function. The problem that I am 
having is on the decrypt.

Example:

<cfset foo = encrypt("johnmurray", "wibble")>

foo then equals "*5)V%5*.Z59RR$"

I save this text to the database. An unusual thing happens when I try to 
decrypt this text as follows;

<cfset foo = decrypt("*5)V%5*.Z59RR$", "wibble")>

foo then equals "johnmurrax"

as you can see the 'y' has become an 'x'.

Now here is the strange thing, 

<cfset foo = encrypt("johnmurray ", "wibble")> - with an extra space at the end 
of johnmurray everything encrypts/decrypts correctly using an 11 character 
string.

also 

<cfset foo = encrypt("johnmurra", "wibble")> - if I make it only 9 characters 
then this also encrypts/decrypts correctly.

It seems to only happen with 10 letter strings?

This is on Coldfusion 7, using a SQL database. I have tried URLEncodedFormat 
before saving to the database and then using URLDecode after retrieveing. As 
this text is defined by the user then I cannot simply say that there can be no 
10 character strings so has anyone ever come across this?

Does anyone have any better encryption ideas I could use? This is a really 
annoying little quirk as to why it only seems to affect 10 character strings, 
weird huh?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219225
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to