|
|
| 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. |
|
|
| Comments |
| No comments were made for this article |
| |
|
All times are GMT
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
|
|