下面给出的是用于加密字符串的程序。我从下面的链接中获取了这段代码并转换为 vb.net。 http://www.eggheadcafe.com/tutorials/csharp/8b53894c-a889-4914-8c46-122980cc44ae/simple-xor-encryption.aspx。这将使用简单的异或加密转换字符串。
Namespace SimpleXOREncryption
Public NotInheritable Class EncryptorDecryptor
Private Sub New()
End Sub
Public Shared key As Integer = 129
Public Shared Function EncryptDecrypt(ByVal textToEncrypt As String) As String
Dim inSb As New StringBuilder(textToEncrypt)
Dim outSb As New StringBuilder(textToEncrypt.Length)
Dim c As Char
For i As Integer = 0 To textToEncrypt.Length - 1
c = inSb(i)
c = ChrW(c Xor key)
outSb.Append(c)
Next
Return outSb.ToString()
End Function
End Class
End Namespace
我收到错误
“未为类型 'char' 和 'integer' 定义运算符 'xor'”
我在哪里犯错了?