加解密文本的函數(shù) |
發(fā)布時(shí)間: 2012/6/26 16:45:38 |
rivate 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) '從待加(解)密字符串中取出一個(gè)字符 strChar = Mid(strSou... 正文: Private Sub Comman1_Click()
'從待加(解)密字符串中取出一個(gè)字符 strChar = Mid(strSource, i, 1) ' 取字符的低字節(jié)和Key1進(jìn)行異或運(yùn)算 bLowData = AscB(MidB(strChar, 1, 1)) Xor Key1 '取字符的高字節(jié)和K2進(jìn)行異或運(yùn)算 bHigData = AscB(MidB(strChar, 2, 1)) Xor Key2 '將運(yùn)算后的數(shù)據(jù)合成新的字符 strEncrypt = strEncrypt & ChrB(bLowData) & ChrB(bHigData) Next 本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |