VB 文件加密

来源:百度知道 编辑:UC知道 时间:2024/06/21 10:44:02
文件内容不定
加密规则:
读取文件,每个字符 加 一个 值
保存成另一个文件

本人不太了解VB的语法与函数,但想用VB搞个工具
希望各位大大多多帮忙

Const n As Integer = 1
Private Sub Form_Load()
dim temp as string ,strT as string ,strX as string
Open "c:\1.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, temp
strT = strT & temp & vbCrLf
Loop
Close #1

For i = 1 To Len(strT)
strx = strx & IIf(Asc(Mid(strT, i, 1)) = 13 Or Asc(Mid(strT, i, 1)) = 10, Mid(strT, i, 1), Chr(Asc(Mid(strT, i, 1)) + n))'解密就读出来 操作一样 加密时是加N 解密时就是减N
Next

Open "c:\2.txt" For Output As #1
Print #1, strx
Close #1

End Sub