Crypto
Getting Started
In Wednesday's lecture we talked about single alphabetic encryption.
The exercise today will ask you to write four methods that deal with
that. The framework is already written and can be found in the code
directory. A simple test framework in main is also included.
Classwork/Lab
- Write makeCode. You want the leave a jumbled
encryption alphabet in the string encrypt. Its meaning is that
the first letter in the string is what 'A' is mapped to, the
2nd, what 'B' is mapped to, etc.
-
Write enCode. This method should use the alphabet
in encrypt to translate your original message in clearText
the an encrypted message in cryptText.
(Note that non-letters, spaces and punctuation, should not be translated.
Just leave them unchanged.)
-
Write makeDecode.
This method should create a decryption alphabet in decrypt that will
be used the translate your encrypted message back to the original.
-
Write deCode. Use the decryption alphabet to recover your
original message into recoverText
(Again: note that non-letters, spaces and punctuation, should not be translated.
Just leave them unchanged.)
Sample Run
Enter text
testing one two three
Input text
TESTING ONE TWO THREE
Encryption alphabet
MALJCOEWSUQDIXKBVZTNPFHYGR
Encrypted text
NCTNSXE KXC NHK NWZCC
Decryption alphabet
BPELGVYWMDOCATFUKZISJQHNXR
Recovered text
TESTING ONE TWO THREE
Submit
Create a README file with both of your names in it if you work with a
partner.
Electronically
submit the classwork through Eclipse your Java code and README file to
the Lab32 folder.