用VB编写好的文件的加密与解密软件,谢谢各位大侠!最好是有源代码.谢谢!
答案:2 悬赏:40 手机版
解决时间 2021-02-18 05:28
- 提问者网友:杀手的诗
- 2021-02-17 11:22
用VB编写好的文件的加密与解密软件,谢谢各位大侠!最好是有源代码.谢谢!
最佳答案
- 五星知识达人网友:醉吻情书
- 2021-02-17 12:20
Option Explicit
Dim i As Long
Dim databuff() As Byte ’定义数组用于存放文件内容
Dim addbuff() As Byte ’定义数组用于存放加密后的文件内容
Dim password() As Byte ’定义数组用于存放密码的ASCII值
Dim filename As String
Private Sub Check1_Click()
If Check1.Value Then ’控制是否显示全部文件
File1.Pattern = "*.*"
Else
File1.Pattern = ".txt"
End If
End Sub
Private Sub Command1_Click()
Dim j As Integer
Dim password_len As Integer
password_len = Len(Text2.Text)
ReDim password(password_len) As Byte
For i = 0 To password_len - 1 ’把密码转化为ASCII码
password(i)= Asc(Mid(Text2.Text,i + 1,1))
Next
If filename = "" Then Exit Sub
Open filename For Binary As #1 ’读取要加密的文件内容
ReDim databuff(LOF(1))
Get #1,, databuff
Close #1
ReDim addbuff(UBound(databuff))As Byte
For i = 0 To UBound(d...Option Explicit
??Dim i As Long
??Dim databuff() As Byte ’定义数组用于存放文件内容
??Dim addbuff() As Byte ’定义数组用于存放加密后的文件内容
??Dim password() As Byte ’定义数组用于存放密码的ASCII值
??Dim filename As String
??Private Sub Check1_Click()??
??If Check1.Value Then ’控制是否显示全部文件
??File1.Pattern = "*.*"
??Else
??File1.Pattern = ".txt"
??End If
??End Sub
??Private Sub Command1_Click()??
??Dim j As Integer
??Dim password_len As Integer
??password_len = Len(Text2.Text)?
??ReDim password(password_len) As Byte
??For i = 0 To password_len - 1 ’把密码转化为ASCII码
??password(i)= Asc(Mid(Text2.Text,i + 1,1))??
??Next
??If filename = "" Then Exit Sub
??Open filename For Binary As #1 ’读取要加密的文件内容
??ReDim databuff(LOF(1))??
??Get #1,, databuff
??Close #1
??ReDim addbuff(UBound(databuff))As Byte
??For i = 0 To UBound(databuff)?
??If j >= password_len Then ’循环使用密码
??j = 0
??Else
??j = j + 1
??End If
??addbuff(i)= databuff(i)Xor password(j)’进行异或运算
??Next
??Open filename For Binary As #1 ’把加密后的内容写入文件
??Put #1,,addbuff
??Close #1
??Text1 = StrConv(addbuff vbUnicode)’显示加密后的文件内容
??Text2.Text = ""
??End Sub
??Private Sub Command2_Click()??
??.End
??End Sub
??Private Sub Dir1_Change()??
??File1.Path = Dir1.Path ’与文件列表框相关联
??End Sub
??Private Sub Drive1_Change()??
??On Error GoTo a0
??Dir1.Path = Drive1.Drive ’与目录列表框相关联
??a0:If Err Then MsgBox(Error(Err))’发生错误,提示错误内容
??End Sub
??Private Sub File1_Click()’单击文件时,显示文件内容
??filename = Dir1.Path + File1.filename
??If filename = "" Then Exit Sub
??Open filename For Binary As #1
??ReDim databuff(LOF(1))??
??Get #1,,databuff
??Close #1
??Text1 = StrConv(databuff,vbUnicode)?
??End Sub
Dim i As Long
Dim databuff() As Byte ’定义数组用于存放文件内容
Dim addbuff() As Byte ’定义数组用于存放加密后的文件内容
Dim password() As Byte ’定义数组用于存放密码的ASCII值
Dim filename As String
Private Sub Check1_Click()
If Check1.Value Then ’控制是否显示全部文件
File1.Pattern = "*.*"
Else
File1.Pattern = ".txt"
End If
End Sub
Private Sub Command1_Click()
Dim j As Integer
Dim password_len As Integer
password_len = Len(Text2.Text)
ReDim password(password_len) As Byte
For i = 0 To password_len - 1 ’把密码转化为ASCII码
password(i)= Asc(Mid(Text2.Text,i + 1,1))
Next
If filename = "" Then Exit Sub
Open filename For Binary As #1 ’读取要加密的文件内容
ReDim databuff(LOF(1))
Get #1,, databuff
Close #1
ReDim addbuff(UBound(databuff))As Byte
For i = 0 To UBound(d...Option Explicit
??Dim i As Long
??Dim databuff() As Byte ’定义数组用于存放文件内容
??Dim addbuff() As Byte ’定义数组用于存放加密后的文件内容
??Dim password() As Byte ’定义数组用于存放密码的ASCII值
??Dim filename As String
??Private Sub Check1_Click()??
??If Check1.Value Then ’控制是否显示全部文件
??File1.Pattern = "*.*"
??Else
??File1.Pattern = ".txt"
??End If
??End Sub
??Private Sub Command1_Click()??
??Dim j As Integer
??Dim password_len As Integer
??password_len = Len(Text2.Text)?
??ReDim password(password_len) As Byte
??For i = 0 To password_len - 1 ’把密码转化为ASCII码
??password(i)= Asc(Mid(Text2.Text,i + 1,1))??
??Next
??If filename = "" Then Exit Sub
??Open filename For Binary As #1 ’读取要加密的文件内容
??ReDim databuff(LOF(1))??
??Get #1,, databuff
??Close #1
??ReDim addbuff(UBound(databuff))As Byte
??For i = 0 To UBound(databuff)?
??If j >= password_len Then ’循环使用密码
??j = 0
??Else
??j = j + 1
??End If
??addbuff(i)= databuff(i)Xor password(j)’进行异或运算
??Next
??Open filename For Binary As #1 ’把加密后的内容写入文件
??Put #1,,addbuff
??Close #1
??Text1 = StrConv(addbuff vbUnicode)’显示加密后的文件内容
??Text2.Text = ""
??End Sub
??Private Sub Command2_Click()??
??.End
??End Sub
??Private Sub Dir1_Change()??
??File1.Path = Dir1.Path ’与文件列表框相关联
??End Sub
??Private Sub Drive1_Change()??
??On Error GoTo a0
??Dir1.Path = Drive1.Drive ’与目录列表框相关联
??a0:If Err Then MsgBox(Error(Err))’发生错误,提示错误内容
??End Sub
??Private Sub File1_Click()’单击文件时,显示文件内容
??filename = Dir1.Path + File1.filename
??If filename = "" Then Exit Sub
??Open filename For Binary As #1
??ReDim databuff(LOF(1))??
??Get #1,,databuff
??Close #1
??Text1 = StrConv(databuff,vbUnicode)?
??End Sub
全部回答
- 1楼网友:西风乍起
- 2021-02-17 13:54
AES BASE64 MD5 URLENC CHARSET 你要哪些呢
AES我认为很强,但数据大时速度较慢,BASE64同样但主要用在网络传输和一些不能使用特殊符号的地方
MD5就不用说了吧
URLENC 这是用在网页编程里不能使用中文以及符号的地方URL 在地址也会用到,有UTF-8 ,GB2312两种
CHARSET 是对网页字符解码,比如是UTF-8里面的中文是乱码, 一些ISO-XXXX 的也会有中文乱码,
也有的网站用的是BIG5繁体,也可以解码成GBK
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯