Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a Ruby program that will take a key word and a text file then print out the encrypted text message. For instance, here is

create a Ruby program that will take a key word and a text file then print out the encrypted text message. For instance, here is a run of the program:

> encrypt

Enter the cipher key > honey

Enter the text file > mythoughts.txt

Enter the encrypted file > mysecret.txt

> encrypt -d

Enter the cipher key > honey

Enter the encrypted file > mysecret.txt

Enter the text file > mythoughts.txt

In the above examples of execution, the first encrypts the file 'mythoughts.txt' to 'mysecret.txt' using the key 'honey' to create the cipher. The second execution decrypts the message in 'mysecrets.txt' using the key 'honey' to create the cipher then writing the deciphered text in 'mythoughts.txt'. Realize that when decrypting, we are reversing the roles of the cipher and the alphabet in substitution for the text. When we encrypt the message, the alphabet character in the text is substituted using the cipher character, but when we decrypt the message, the cipher character in the encrypted text is substituted using the alphabet character.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions