Quick Search for:  in language:    
functions,encrypt,decrypt,alphanumeric,string
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 203,988. lines
 Jobs: 110. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login


 

 


Latest Code Ticker for ASP/ VbScript.
aZoaPeS
By Simeon Albertson on 1/20


Move Window , Funs Stuff
By Jareh Ali Mohamed H. Al-Malki on 1/19


Click here to see a screenshot of this code!Rapid Classified v2.0
By Gurgen Alaverdian on 1/17

(Screen Shot)

Click here to see a screenshot of this code!Gallery Image with Zoom
By Marcelo Valle Franco on 1/12

(Screen Shot)

Click here to see a screenshot of this code!ASP Photo Competition
By Saul Bryan on 1/12

(Screen Shot)

Execute DTS package
By Himadrish Laha on 1/12


Connecting to a MySQL with ADO, DAO and RDO
By Ahmed Magdy Ezzeldin on 1/11


Automatic Form Insertion To Database
By Yasar Bayar on 1/11


Click here to see a screenshot of this code!Find Closest Physical Location (based on zip code, etc)
By Mark Kahn on 1/11

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

tsp_encode / tsp_decode

Print
Email
 
VB icon
Submitted on: 12/15/2003 11:11:15 PM
By: thorpe hepburn  
Level: Beginner
User Rating: Unrated
Compatibility:ASP (Active Server Pages), VbScript (browser/client side)

Users have accessed this code 725 times.
 
(About the author)
 
     two functions to encrypt and decrypt an alphanumeric string. good for keeping passwords and emails a little more secure.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: tsp_encode / tsp_decode
    ' Description:two functions to encrypt a
    '     nd decrypt an alphanumeric string. good 
    '     for keeping passwords and emails a littl
    '     e more secure.
    ' By: thorpe hepburn
    '
    ' Inputs:
    tsp_encode(mystring) - string To be encoded
    tsp_decode(mystring) - string To be decoded
    '
    ' Returns:
    tsp_encode(mystring) - a encoded string
    tsp_decode(mystring) - a decoded string
    '
    ' Assumes:these functions are my first a
    '     ttempt at any sort of encryption and onl
    '     y cover characters from a-z & 1-0. they 
    '     could be though, quite easily extended t
    '     o cover special characters.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=8660&lngWId;=4    'for details.    '**************************************
    
    <%
    ' / usage example /
    ''''''''''''''''''''''''''''''''''''''''
    '
    	mystring = "something To encode"
    		response.write mystring & "<BR>"
    	encoded = tsp_encode(mystring)
    		response.write encoded & "<BR>"
    	decoded = tsp_decode(encoded)
    		response.write decoded
    ''''''''''''''''''''''''''''''''''''''''
    '
    ' / encode function /
    	function tsp_encode(var)
    ' / declare variables /
    		Dim total, char, encode, complete
    	' / Get total number of characters In the String /
    		total = len(var)
    		char = 1
    	' / Loop through Each character In the String /
    		For i = 1 To total
    		' / extract character and convert To lower Case For easy compare /
    			encode = lcase(mid(var,char,1))
    		' / replace the character With the encoded equivelent /
    			Select Case encode
    				Case "a"
    					encode = replace(encode,"a","o")
    				Case "b"
    					encode = replace(encode,"b","9")
    				Case "c"
    					encode = replace(encode,"c","f")
    				Case "d"
    					encode = replace(encode,"d","6")
    				Case "e"
    					encode = replace(encode,"e","u")
    				Case "f"
    					encode = replace(encode,"f","3")
    				Case "g"
    					encode = replace(encode,"g","l")
    				Case "h"
    					encode = replace(encode,"h","c")
    				Case "i"
    					encode = replace(encode,"i","4")
    				Case "j"
    					encode = replace(encode,"j","n")
    				Case "k"
    					encode = replace(encode,"k","p")
    				Case "l"
    					encode = replace(encode,"l","x")
    				Case "m"
    					encode = replace(encode,"m","r")
    				Case "n"
    					encode = replace(encode,"n","2")
    				Case "o"
    					encode = replace(encode,"o","t")
    				Case "p"
    					encode = replace(encode,"p","v")
    				Case "q"
    					encode = replace(encode,"q","8")
    				Case "r"
    					encode = replace(encode,"r","a")
    				Case "s"
    					encode = replace(encode,"s","z")
    				Case "t"
    					encode = replace(encode,"t","k")
    				Case "u"
    					encode = replace(encode,"u","e")
    				Case "v"
    					encode = replace(encode,"v","w")
    				Case "w"
    					encode = replace(encode,"w","g")
    				Case "x"
    					encode = replace(encode,"x","i")
    				Case "y"
    					encode = replace(encode,"y","0")
    				Case "z"
    					encode = replace(encode,"z","5")
    				Case "1"
    					encode = replace(encode,"1","m")
    				Case "2"
    					encode = replace(encode,"2","7")
    				Case "3"
    					encode = replace(encode,"3","b")
    				Case "4"
    					encode = replace(encode,"4","q")
    				Case "5"
    					encode = replace(encode,"5","1")
    				Case "6"
    					encode = replace(encode,"6","h")
    				Case "7"
    					encode = replace(encode,"7","s")
    				Case "8"
    					encode = replace(encode,"8","d")
    				Case "9"
    					encode = replace(encode,"9","y")
    				Case "0"
    					encode = replace(encode,"0","j")
    			End Select
    		' / incriment To the Next character /
    			char = char + 1
    		' / put the String back together using the encoded characters /
    			complete = complete & encode
    		Next
    	' / send results To where function was called /			
    		tsp_encode = complete
    	End function
    ' / decode function /
    	function tsp_decode(var)
    	' / Declare variables and create the dictionary object /
    		Dim total, char, decode, complete
    	' / Get total number of characters In the String /
    		total = len(var)
    		char = 1
    	' / Loop through Each character In the String /
    		For i = 1 To total
    		' / extract character and convert To lower Case For easy compare /
    			decode = lcase(mid(var,char,1))
    		' / replace the character With the decoded equivelent /
    			Select Case decode
    				Case "a"
    					decode = replace(decode,"a","r")
    				Case "b"
    					decode = replace(decode,"b","3")
    				Case "c"
    					decode = replace(decode,"c","h")
    				Case "d"
    					decode = replace(decode,"d","8")
    				Case "e"
    					decode = replace(decode,"e","u")
    				Case "f"
    					decode = replace(decode,"f","c")
    				Case "g"
    					decode = replace(decode,"g","w")
    				Case "h"
    					decode = replace(decode,"h","6")
    				Case "i"
    					decode = replace(decode,"i","x")
    				Case "j"
    					decode = replace(decode,"j","0")
    				Case "k"
    					decode = replace(decode,"k","t")
    				Case "l"
    					decode = replace(decode,"l","g")
    				Case "m"
    					decode = replace(decode,"m","1")
    				Case "n"
    					decode = replace(decode,"n","j")
    				Case "o"
    					decode = replace(decode,"o","a")
    				Case "p"
    					decode = replace(decode,"p","k")
    				Case "q"
    					decode = replace(decode,"q","4")
    				Case "r"
    					decode = replace(decode,"r","m")
    				Case "s"
    					decode = replace(decode,"s","7")
    				Case "t"
    					decode = replace(decode,"t","o")
    				Case "u"
    					decode = replace(decode,"u","e")
    				Case "v"
    					decode = replace(decode,"v","p")
    				Case "w"
    					decode = replace(decode,"w","v")
    				Case "x"
    					decode = replace(decode,"x","l")
    				Case "y"
    					decode = replace(decode,"y","9")
    				Case "z"
    					decode = replace(decode,"z","s")
    				Case "1"
    					decode = replace(decode,"1","5")
    				Case "2"
    					decode = replace(decode,"2","n")
    				Case "3"
    					decode = replace(decode,"3","f")
    				Case "4"
    					decode = replace(decode,"4","i")
    				Case "5"
    					decode = replace(decode,"5","z")
    				Case "6"
    					decode = replace(decode,"6","d")
    				Case "7"
    					decode = replace(decode,"7","2")
    				Case "8"
    					decode = replace(decode,"8","q")
    				Case "9"
    					decode = replace(decode,"9","b")
    				Case "0"
    					decode = replace(decode,"0","y")
    			End Select
    		' / increment To the Next character /
    			char = char + 1
    		' / put the String back together using the encoded characters /
    			complete = complete & decode
    		Next
    	' / send results To where function was called /
    		tsp_decode = complete
    	End function
    %>


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.