Please add all the explanation so i can understand everything.



Unformatted Attachment Preview

Don't use plagiarized sources. Get Your Custom Essay on
Please add all the explanation so i can understand everything.
Just from $10/Page
Order Essay

 Task 1 (8 pts)
Now that you have a
working password checker, we will add some encryption so
that you can be a little bit safer when storing user
passwords. In this task, you are to create a method
that implements a Caesar cipher. 

A Caesar cipher is an old and very insecure method of
encryption. It involves shifting characters in order to
create a new string. For example, if the input string
is “abc” then the output string would be “bcd” (see that
every character was shifted 1 position to the right). If we
wanted to revert the encrypted string back to the original,
we would simply shift it 1 to the left.
The number of positions to shift is referred to as the key. So
if the key is 3, then we would shift right 3 to encrypt and
left 3 to decrypt.

Create a method that takes three arguments: a String
representing the plain text, an integer that represents the
key, and another integer that represents the mode (encrypt
or decrypt). Here, mode is 0 for encryption and 1 for

To make things easier, we will be dealing with ASCII characters
from the range of decimal 33 to decimal 126. You can find
the ASCII table here:

This makes
the size of our alphabet to be 126 – 33 = 93.
Cipher =
E(PlainText) = (PlainText + key) mod

PlainText = D(Cipher) = (Cipher – key) mod


Given the input string “TacoTuesday!12”: the first character
is ’T’ which is represented in the ASCII table as decimal
84. Our alphabet starts at decimal 33, so we need to first
subtract 33 so that our decimal representation of the
character lies within the appropriate range (0-92).

x = 84 – 33 = 51

Now we can use our key value and alphabet size to properly
convert this character as follows:

(x + key) mod alphabet_size = (51 + 1) mod 93 = 52

Now we have our encrypted character, looking up in the ASCII
table gives us the character ‘4’. Wait a minute… our key
was 1 meaning that we should have only shifted right by 1.
We would expect our encrypted character to be ‘U’. Remember
that we subtracted 33 from our value originally so that the
value lied within the appropriate range. All that is left
is to add 33 back to the number.
52 + 33 = 85

85 on the ASCII table converts to the letter ‘U’. Great! We
successfully encrypted the character.

To help you get started, you can use the following method

public static String caesarCipher(String text, int key, int
mode) {

final int alphabetSize = 93;



Task 2 (2 pts)

Using your method from task 1, decrypt the
following strings using key =



Purchase answer to see full

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 30% with the discount code ESSAYSHELP