Sau đây chúng tôi xin chia sẻ code mã hóa VB
Function Encrypt(ByVal inpt As String) As StringDim temp As StringDim tempA As StringDim Rand As String100:RandomizeRand = Right(Rnd, 3)rad = Left(Rand, 1)If Left(Rand, 1) = ''-'' ThenGoTo 100End IfFor i = 1 To Len(inpt)crntASC = Asc(Mid(inpt, i, 1))tempA = ((crntASC) Xor (Rand + i + rad)) + (i + rad)If Len(tempA) = 4 Thentemp = temp & tempAElseIf Len(tempA) = 3 Thentemp = temp & ''0'' & tempAElseIf Len(tempA) = 2 Thentemp = temp & ''00'' & tempAElseIf Len(tempA) = 1 Thentemp = temp & ''000'' & tempAEnd IfNext itemp = Rand & tempEncrypt = tempEnd FunctionFunction Decrypt(ByVal inpt As String) As StringRand = Left(inpt, 3)For i = 4 To (Len(inpt) - 3) Step 4z = z + 1tempA = Mid(inpt, i, 4)tempA = ((tempA - (z + Left(Rand, 1))) Xor (Rand + z + Left(Rand, 1)))temp = temp & Chr(tempA)Next iDecrypt = tempEnd Function
Theo diễn đàn tin học
Nguồn : Code mã hoá VB






0 nhận xét:
Đăng nhận xét