[1 / 1 / ?]
235KiB, 1400x1786, 12006674_876296952456173_3912186626639804851_o.jpg
Quoted By:
hey /g/
does anyone want to help me with some coding?
sub encrypt()
Console.Write("please enter a message To be encrypted: ")
message = Console.ReadLine
Dim letterarray() As Char = message.ToCharArray
Console.Write("what key would you like to use?:")
key = Console.ReadLine()
For i = 0 To letterarray.Length - 1
encmessage = (encmessage & Chr(Asc(letterarray(i)) + key))
If Asc(letterarray(i)) + key > 122 Then
encmessage = encmessage & Chr(Asc(letterarray(i)) + key - 25)
End If
Next
end sub
This code is for a simple shift cipher, but the issue I have is, once you go past the ascii code for 'z' you get a symbol instead of 'a'
i was hoping this part of the code would fix it, but it hasn't D:
If Asc(letterarray(i)) + key > 122 Then
encmessage = encmessage & Chr(Asc(letterarray(i)) + key - 26)
basically what I need is for 26 to be subtracted if the ascii value equals more than 122
What do I do?
does anyone want to help me with some coding?
sub encrypt()
Console.Write("please enter a message To be encrypted: ")
message = Console.ReadLine
Dim letterarray() As Char = message.ToCharArray
Console.Write("what key would you like to use?:")
key = Console.ReadLine()
For i = 0 To letterarray.Length - 1
encmessage = (encmessage & Chr(Asc(letterarray(i)) + key))
If Asc(letterarray(i)) + key > 122 Then
encmessage = encmessage & Chr(Asc(letterarray(i)) + key - 25)
End If
Next
end sub
This code is for a simple shift cipher, but the issue I have is, once you go past the ascii code for 'z' you get a symbol instead of 'a'
i was hoping this part of the code would fix it, but it hasn't D:
If Asc(letterarray(i)) + key > 122 Then
encmessage = encmessage & Chr(Asc(letterarray(i)) + key - 26)
basically what I need is for 26 to be subtracted if the ascii value equals more than 122
What do I do?
