Question: Build an interactive model in Mathematica for encoding/decoding English text messages that have been encrypted using a Vigenere cipher with keyword k. Your model should

Build an interactive model in Mathematica for encoding/decoding English text messages that have been encrypted using a Vigenere cipher with keyword k. Your model should have a textbox s, in which the text to be encoded/decoded can be written, and a textbox k for the keyword. By default, these boxes should be populated with the encrypted text below, and respectively with the key that you have obtained after the RSA decoding process. For these default settings, the model should output the decoded text.

s="KLIQEJXUULFYTECJXFRPKLOVCNLOPYBITKCSISWMLXOIRYIWDWKLIQEJXUULFYT"

Attempted using the following code but no luck. Can someone please help?

Manipulate[ encode[text_String, key_String] := Module[{textCode, keyCode}, textCode = Cases[ToCharacterCode[ ToUpperCase@ text], _?(IntervalMemberQ[Interval@{65, 90}, #] &)] - 65; keyCode = Cases[ToCharacterCode[ ToUpperCase@ key], _?(IntervalMemberQ[Interval@{65, 90}, #] &)] - 65; keyCode = If[Length[textCode] < Length[keyCode], keyCode[[;; Length@textCode]], PadRight[keyCode, Length@textCode, keyCode]]; FromCharacterCode[Mod[textCode + keyCode, 26] + 65]], decode[text_String, key_String] := Module[{textCode, keyCode}, textCode = Cases[ToCharacterCode[ ToUpperCase@ text], _?(IntervalMemberQ[Interval@{65, 90}, #] &)] - 65; keyCode = Cases[ToCharacterCode[ ToUpperCase@ key], _?(IntervalMemberQ[Interval@{65, 90}, #] &)] - 65; keyCode = If[Length[textCode] < Length[keyCode], keyCode[[;; Length@textCode]], PadRight[keyCode, Length@textCode, keyCode]]; FromCharacterCode[Mod[textCode - keyCode, 26] + 65]], {textt, {\ "KLIQEJXUULFYTECJXFRPKLOVCNLOPYBITKCSISWMLXOIRYIWDWKLIQEJXUULFYT"}}, {keyword, {"heado", "BYE"}} ]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!