private function encrypt(byval strsource as string, byval key1 as byte, _
byval key2 as integer) as string
dim blowdata as byte
dim bhigdata as byte
dim i as integer
dim strencrypt as string
dim strchar as string
for i = 1 to len(strsource)
'从待加(解)密字符串中取出一个字符
strchar = mid(strsource, i, 1)
' 取字符的低字节和key1进行异或运算
blowdata = ascb(midb(strchar, 1, 1)) xor key1
'取字符的高字节和k2进行异或运算
bhigdata = ascb(midb(strchar, 2, 1)) xor key2
'将运算后的数据合成新的字符
strencrypt = strencrypt & chrb(blowdata) & chrb(bhigdata)
next
encrypt = strencrypt
end function
新闻热点
疑难解答