Sub decrytpion()
Dim plain As String
Dim keyword As String
Dim keyword2 As String
Dim encoded_message() As Integer
Console.ForegroundColor = ConsoleColor.Red
Console.Write("Enter your plaintext: ")
plain = Console.ReadLine.ToUpper()
Console.Write("Enter your keyword: ")
keyword = Console.ReadLine.ToUpper()
Console.Write("Enter your second keyword: ")
keyword2 = Console.ReadLine.ToUpper()
While plain.Length > keyword.Length
keyword = keyword + keyword
End While
While plain.Length > keyword2.Length
keyword2 = keyword2 + keyword2
End While
keyword = Asc(keyword) 'finds out ascii value of keyword
keyword2 = Asc(keyword2) 'finds out ascii value of keyword2
Console.ForegroundColor = ConsoleColor.Magenta
Console.WriteLine("here is your decrypted message")
ReDim Preserve encoded_message(0 To plain.Length - 1)
For stepper As Integer = 0 To plain.Length - 1
encoded_message(stepper) = Asc(plain(stepper)) - keyword - keyword2 + 96
Console.Write(Chr(encoded_message(stepper)))
Next
Console.ReadLine()
End Sub
它意味着通過將每個字母按字母順序移動一定量來破譯放入的單詞。我該如何糾正這個雙關鍵字解碼?