dev-exchange.com logo

dev-exchange.com latest topics RSS feed

Book mark: Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your delicious account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your digg account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your blinklist account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your reddit account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to Dzone Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your furl account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your stumble account Add http://www.dev-exchange.com/cms_view_article.php?aid=26&start=0 to your Yahoo myweb account
Article Menu
Google
ColdFusion MX
PHP
ASP
ASP.Net
XML-XSLT
JavaScript
SQL Server
AJAX
 


 
Article
S Rajan
Author

Articles: 2 Comments: 0
 Posted: Fri May 09, 2008 12:47 pm

There are different ways strings can be encrypted in CFM. It depends upon the scenario how we need it. Some cases you need to encrypt the data but no need to decrypt it back. That means situation like store the encrypted password in database but you may not want to expose it to anyone. Here I’m going to show few examples how you can encrypt the CFM string.

Encrypt ()

Use this function to encrypt a string.

Code:
<cfset myString=”this is the data”>
<cfset myKey=”thisisthekey”>
<cfset myencryptedString=Encrypt (myString, myKey)>

<cfoutput>#myencryptedString# </cfoutput>



Decrypt ()

In case you need to get the encrypted data back to your original string. You can try this

Code:
<cfset myOriginalString=encrypt (myencryptedString, myKey)>

<cfoutput>#myOriginalString#</cfoutput>



HASH()

Use hash function if you don’t want to decrypt the value back. This is the safest method to store passwords in database. It converts a variable-length string to a fixed-length string that can act as a fingerprint or unique identifier for the original string. You can specify what algoritham should be used for this conversion.

Code:
<cfset myString=”this is the data”>
<cfset myHashedString=HASH (myString)>
<cfoutput>#myHashedString # </cfoutput>


There are various other conversion and security functions are available in cold fusion. You may take a look at the cold fusion documentation for more details.
Rating: 0.00/5.00 [0]

Comments
No comments were made for this article
 

All times are GMT

Jump to:  
You cannot post articles in this chapter
You cannot edit your articles in this chapter
You cannot delete your articles in this chapter
You cannot rate articles in this chapter

You cannot post comments in this chapter
You cannot edit your comments in this chapter
You cannot delete your comments in this chapter
You cannot rate comments in this chapter


© 2008 dev-exchange.com
Powered by phpBB. Theme DEVPPL.