通过使用以下vb函数,对数据库进行加密和解密运算,代码如下:
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
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: redis怎么分页获取数据库