有段二进制的加密代码,想请大家帮我看看?
Dim byt() As Byte
'Dim inttmp As Integer
'Open strfile For Binary As #1
'ReDim byt(LOF(1) - 1)
'Get #1, , byt
'For inttmp = 0 To UBound(byt)
' byt(inttmp) = byt(inttmp) Xor 25 '逐字节进行异或
'Next
'Put #1, 1, byt
'Close #1
我想问的是,我用它来加密word文件,如果word文件超过30k以上的话,这个程序中的for循环就不好用了,我想请大家帮我看看,是那里出了问题。
[解决办法]
Dim byt() As Byte
Dim inttmp As Long 'Integer类型的取值范围太小, 改为Long
Open "D:\1.doc " For Binary As #1
ReDim byt(LOF(1) - 1)
Get #1, , byt
For inttmp = 0 To UBound(byt)
byt(inttmp) = byt(inttmp) Xor 25 '逐字节进行异或
Next
Seek #1, 1 '需要重新定位到文件头部
Put #1, 1, byt
Close #1