This provides a small procedure for file encryption, for your reference.
<%@ Language = vbscript%>
<%
Response.Expires = 0
p = "ABCDEFG"
Set testpwd = New Cpassword
TESTPWD.ENPWD P
Testpwd.unpwd testpwd.showpwd (True)
K = Testpwd.showpwd (True)
L = testpwd.showpwd (False)
Set testpwd = Nothing
With Response
. Write "Original:" & P & "<br>"
. Write "Encrypted:" & K & "<br>"
. Write "After decryption:" & L & "<br>"
End With
Class Cpassword
Private cenpwd,cunpwd
Private Function My_hex (My_hex_source)
My_hex = Hex (My_hex_source)
If Len (My_hex) = 1 Then
My_hex = "0" & My_hex
End If
End Function
Private Function My_unhex (My_unhex_source)
If Len (My_unhex_source) = 2 Then
Temp_value = My_hexreplace (left (my_unhex_source,1))
End If
My_unhex = Temp_value * + my_hexreplace (right (my_unhex_source,1))
End Function
Private Function my_hexreplace (My_hexreplace_source)
If ASC (my_hexreplace_source) > Then
My_hexreplace = ASC (UCase (My_hexreplace_source))-55
Else
My_hexreplace = ASC (my_hexreplace_source)-48
End If
End Function
Public Property Get Showpwd (EnP)
' Output
If EnP Then
Showpwd = Cenpwd
Else
Showpwd = Cunpwd
End If
End Property
Sub enpwd (Enpwd_source)
If Enpwd_source = "" Then
CENPWD = 0
Exit Sub
Else
Randomize
Key = Rnd * 256
While Key = 0
Key = Rnd * 256
Wend
For I=1 to Len (Enpwd_source)
temp_string = Key Xor Asc (Mid (enpwd_source,i,1))
CRC = CRC + Temp_string
Cenpwd = cenpwd + My_hex (temp_string)
Next
Cenpwd = My_hex (Key) + strreverse (cenpwd) + my_hex (CRC Mod 256)
End If
End Sub
Sub unpwd (Unpwd_source)
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.