no one?
anyway, realised my mistake as soon as I left the office - each message has
to be decrypted individually.
Just because they are all encrypted using the same algorithm and appended
doesnt mean you can decrypt them all in one go.

-----Original Message-----
From: Kerry [mailto:[EMAIL PROTECTED]
Sent: 09 November 2005 18:48
To: CF-Talk
Subject: encrypt + file append + decrypt


okay, been looking at this for a while now, cant see why its not working,
suggestions appreciated!

<!---
environment:
cfmx 6.1, win2K

code objective:
encrypt string + linebreak, append to file (repeat), read file, decrypt,
display in textarea

expected output:
1
2
3
4
5
6
7
8
9
10

actual output:
1
--->

<cfset logdir = getdirectoryfrompath(getcurrenttemplatepath())>
<cfset logfil = "encrypted.txt">
<cfset logpath = logdir&logfil>
<cfif fileexists(logdir&logfil)>
        <cffile action="delete" file="#logpath#">
</cfif>
<cfloop from="1" to="10" index="i">
                <cfset message =
encrypt(URLEncodedFormat(i&chr(13)&chr(10)),hash(logfil))>
                <cfif not fileexists(logdir&logfil)>
                                <cffile action="write" file="#logpath#" 
output="#message#"
addnewline="no">
                        <cfelse>
                                <cffile action="append" file="#logpath#" 
output="#message#"
addnewline="no">
                        </cfif>
</cfloop>
<cffile action="read" file="#logpath#" variable="filcontents">
<cfoutput>
<textarea>
#URLDecode(decrypt(filcontents,hash(logfil)))#
</textarea>
</cfoutput>


thx all.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223809
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