ASP string encryption and decryption function _ Application techniques
Source: Internet
Author: User
<%
A_key=split ("96,44,63,80", ",") ' defines the key
' ********* encryption Process *********
Function EnCrypt (M)
Dim Strchar,ikeychar,istringchar,i
K=0
For I = 1 to Len (m)
Ikeychar =cint (A_key (k))
Istringchar = ASC (Mid (m,i,1)) ' Gets the ASCII code value of the character
Icryptchar = Ikeychar Xor Istringchar ' perform an exclusive OR operation
' Shift the key to the operation
If k<3 Then
K=k+1
Else
K=0
End If
c = C & Chr (Icryptchar)
Next
EnCrypt = C
End Function
' ********* the process of decryption *********
Function DeCrypt (c)
Dim Strchar, Ikeychar, Istringchar, I
K=0
For I = 1 to Len (c)
Ikeychar =cint (A_key (k))
Istringchar = ASC (Mid (c,i,1))
Idecryptchar = Ikeychar Xor Istringchar ' perform an exclusive OR operation
' Shift the key to the operation
If k<3 Then
K=k+1
Else
K=0
End If
strdecrypted = strdecrypted & Chr (Idecryptchar)
Next
DeCrypt = strdecrypted
End Function
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service