Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27355

Converting each letter in a sentence to a different number?

$
0
0
Hey guys, so I'm looking at developing a program where the user enters a sentence and clicks the button and behind the scenes the program uses matrices to encrypt the sentence. It will also decode any sentence that has been encoded in the same program. I am ,however, having trouble working something out. To encrypt the message I need to first convert the sentence into numbers, each letter correlating to a number. It's just the basic, A = 1, B = 2, C = 3 and so on up to 26. I then will put these into matrices, multiply them by a default matrix, mod 26 the numbers, then convert each number back to a letter. For example GAME = 7, 1, 13 and 5. Multiplying these by a 2 by 2 matrix gives 15, 9, 31, 23. Mod 26 each of those gives 15, 9, 5 and 23. Thus the encrypted message reads:
O I E W, which is practically unreadable unless decrypted properly.

TLDR: Anyway, so what I need to program to do is read the word/sentence given, for example GAME, convert each letter to a different, pre-set number, then I'll do the calculations behind the scenes, then when the final numbers are found I need it to convert each one back into it's correlating letter. I need to do this in the least amount of code as possible, so having a textbox for each letter in the sentence, that runs 26 if statements checking which letter it is and setting the number accordingly, is not feasible really.

Any and all help is well and truly appreciated! Thanks!

Viewing all articles
Browse latest Browse all 27355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>