home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / decrypt.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.1 KB  |  37 lines

  1. <!--- This example shows the use of encrypt and decrypt --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Decrypt Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY bgcolor=silver>
  8. <H3>Decrypt Example</H3>
  9.  
  10. <P>This function allows for the encryption and decryption of a 
  11. string. Try it out by entering your own string and a key of your 
  12. own choosing and seeing the results.
  13. <CFIF IsDefined("form.myString")>
  14.    <CFSET string = form.myString>
  15.    <CFSET key = form.myKey>
  16.    <CFSET encrypted = encrypt(string, key)>
  17.    <CFSET decrypted = decrypt(encrypted, key)>
  18.    <CFOUTPUT>
  19.      <H4><B>The string:</B></H4> #string# <BR>
  20.      <H4><B>The key:</B></H4> #key#<BR>
  21.      <H4><B>Encrypted:</B></H4> #encrypted#<BR>
  22.      <H4><B>Decrypted:</B></H4> #decrypted#<BR>
  23.     </CFOUTPUT>
  24. </CFIF>
  25. <FORM action="encrypt.cfm" method="post">
  26. <P>Input your key:
  27. <P><INPUT TYPE="Text" NAME="myKey" VALUE="foobar">
  28. <P>Input your string to be encrypted:
  29. <P><TEXTAREA NAME="myString" COLS="40" ROWS="5" WRAP="VIRTUAL">
  30. This string will be encrypted (try typing some more)
  31. </TEXTAREA>
  32. <INPUT TYPE="Submit" VALUE="Encrypt my String">
  33. </FORM>
  34.  
  35. </BODY>
  36. </HTML>       
  37.