devxlogo

Encode/Decode – Two routines for ASP encryption

' These two VBScript routines can be use to encrypt data passed on the ' querystring, ' so that users can't decode what is being passed between ASP pages.' USE: sField = Decode(request.querystring(encode("sParm")))Function Decode(sIn)    dim x, y, abfrom, abto    Decode="": ABFrom = ""    For x = 0 To 25: ABFrom = ABFrom & Chr(65 + x): Next     For x = 0 To 25: ABFrom = ABFrom & Chr(97 + x): Next     For x = 0 To 9: ABFrom = ABFrom & CStr(x): Next     abto = Mid(abfrom, 14, Len(abfrom) - 13) & Left(abfrom, 13)    For x=1 to Len(sin): y=InStr(abto, Mid(sin, x, 1))        If y = 0 then            Decode = Decode & Mid(sin, x, 1)        Else            Decode = Decode & Mid(abfrom, y, 1)        End If    NextEnd Function' USE: location.href="nextpage.asp?" & encode("sParm=" & sData)Function Encode(sIn)    dim x, y, abfrom, abto    Encode="": ABFrom = ""    For x = 0 To 25: ABFrom = ABFrom & Chr(65 + x): Next     For x = 0 To 25: ABFrom = ABFrom & Chr(97 + x): Next     For x = 0 To 9: ABFrom = ABFrom & CStr(x): Next     abto = Mid(abfrom, 14, Len(abfrom) - 13) & Left(abfrom, 13)    For x=1 to Len(sin): y = InStr(abfrom, Mid(sin, x, 1))        If y = 0 Then             Encode = Encode & Mid(sin, x, 1)        Else             Encode = Encode & Mid(abto, y, 1)        End If    NextEnd Function 

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  Seven Service Boundary Mistakes That Create Technical Debt

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.