最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
怎样给文件加密最安全(一种方法)?
时间:2022-06-30 09:16:26 编辑:袖梨 来源:一聚教程网
这里提供了文件加密的一段小程序,以供大家参考.
<%@ 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 "原文:" & p & "
"
.Write "加密后:" & k & "
"
.Write "解密后:" & L & "
"
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 * 16 + My_HexReplace(Right(My_UnHex_Source,1))
End Function
Private Function My_HexReplace(My_HexReplace_Source)
If Asc(My_HexReplace_Source) > 64 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)
' 输出
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)
<%@ 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 "原文:" & p & "
"
.Write "加密后:" & k & "
"
.Write "解密后:" & L & "
"
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 * 16 + My_HexReplace(Right(My_UnHex_Source,1))
End Function
Private Function My_HexReplace(My_HexReplace_Source)
If Asc(My_HexReplace_Source) > 64 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)
' 输出
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)
相关文章
- 无期迷途主线前瞻直播总结 无期迷途主线前瞻直播内容介绍 11-22
- 以下哪种非遗技艺是用针在纸上绣画 蚂蚁新村11月21日答案 11-22
- 江南百景图听风塔怎么样 11-22
- 原神恰斯卡圣遗物怎么搭配 11-22
- 2024年霸王茶姬11月22日口令是什么 2024.11.22霸王茶姬口令介绍 11-22
- 光遇11.21季节蜡烛在哪里 光遇11月21日季节蜡烛位置攻略 11-22