Find Jobs
Hire Freelancers

C Hill Cipher

$10-30 USD

Completed
Posted almost 7 years ago

$10-30 USD

Paid on delivery
In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Hill cipher where the Hill matrix can be any size from 2 x 2 up to 9 x 9. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program compile and run from the command line. The program executable must be named “hillcipher” (all lower case, no spaces or file extension). input the required file names as command line parameters. Your program may NOT prompt the user to enter the file names. The first parameter must be the name of the encryption key file, as described below. The second parameter must be the name of the file to be encrypted, as also described below. The sample run command near the end of this document contains an example of how the parameters will be entered. Your program should open the two files, echo the input to the screen, make the necessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below. Note: If the plaintext file to be encrypted doesn't have the proper number of alphabetic characters, pad the last block as necessary with the letter 'X'. (Yes, this is different from what is in our class slides, but it is necessary for us to do this so we can know what outputs to expect for our test inputs. Encryption Key File Format The encryption key file will store a single positive integer, n (1 < n < 10), on the first line, indicating the number of rows and columns in the encryption matrix. The following n lines will contain the contents of each row, in order, of the encryption matrix, separated by spaces. Format of the File to be Encrypted The file to be encrypted can be any valid text file with no more than 9991 letters in it. (Thus, it's safe to store all characters in the file in a character array of size 10000, including any padding characters.) Please note that the input text file will also generally have punctuation, numbers, special characters, and whitespace in it, which should be ignored. You should also ignore whether a letter is uppercase or lowercase in the input file. Thus, you should treat ‘A’ and ‘a’ the same in your program. Output Format The program must output the following to the console (terminal) screen: Echo the input key file Echo the input plaintext file Ciphertext output produced from running the cipher against the input plaintext file. The ciphertext output portion should should consist of only lowercase letters in rows of exactly 80 letters per row, except for the the last row, which may possibly have fewer. These characters should correspond to the ciphertext produced by encrypting all the letters in the input file. Please note that only the alphabetic letters in the input plaintext file will be encrypted. All other characters should be ignored. What to Turn In over WebCourses You must submit this assignment in the form specified at the top of this assignment. Program Notes and Hints Your program must read in an input plaintext file that may contain uppercase letters, lowercase letters and non-letter characters. Your program must distinguish between these three groups so that only the letters get encrypted. All non-letter characters in the file are simply skipped and not counted as part of the plaintext. Please note that although both upper case and lower case letters will be encrypted, your program should not treat them differently, that is, the program should process an upper case input letter the same as the corresponding lower case letter, i.e., it should treat an ‘A’ the same as an ‘a’. One possible breakdown to solve this problem is as follows: 1) Write a section of code or function that reads only the upper and lower case letters in the input file into an char array of size 10000, storing only the appropriate lowercase letters in the character array. 2) Write a section of code or function that takes as input the array from section 1 and the encryption key and produces an array of ciphertext storing only lowercase letters. 3) Write a section of code or function that takes as input the array storing the ciphertext and outputs it to the screen in the format specified. Additional functions or code will be needed to echo the input key and plaintext files. Sample Key File 4 9 12 13 1 7 3 6 9 8 4 2 1 10 5 15 3 Sample Input File Security professionals have said for years that the only way to make a computer truly secure is for it to not be connected to any other computers, a method called airgapping. Then, any attack would have to happen physically, with the attacker actually entering the room and accessing the computer that way, which is incredibly unlikely. In the case of computers containing highly sensitive information, additional, physical security can always be added in the form of security guards, cameras, and so on. Researchers at Georgia Institute of Technology have uncovered a vulnerability in all computers, however, which can be exploited regardless of an air gap. It’s a vulnerability which you’d never suspect, and it’s one that’s hard to fight against. All CPUs emit electromagnetic signals when they are performing tasks, and the first thing these researchers discovered was that binary ones and zeroes emit different levels. The second thing they discovered is that electromagnetic radiation is also emitted by the voltage fluctuations and that it can be read from up to six meters away. These signals, by the way, are known as side-channels, and they are well-documented in the cryptography field. Corresponding Output File wsceafwvgznsacsihctehylsayiyanlevvrznraqaimmhdcajbjnuqowykyivehgkiztslktzvtlhxbb lehmcpoddwkbnrmwpszcognnoxhsujopvehggfgfunbegpydafnalyubtzumbaryxctoolpkueyssrjy cdyhojobqftmdqgbdfftfpcmptrlqblscygqqqdxwtlikntstkzynvmmvpysnfggiyyorwarxoifrocr rcncuxmfjhrdnuqlnmwfonkzfaqrzcsxurclysqewceqsrudvehgixiljruwhapsojuzfyktsnyjyhwl vrkceovbtuqheptotuqheqeyygyqfrognudutffdcjkvhektblwuzixkijszqyjnwsceafwvzvpdjjwu nqqfwxruffhfxpkedwbggfgfxpqkrduinkpehormclniilpmejihjohafckdfanspsnorbauspqbypan fmxwfpgccdibgdcrdqevwnmtyvwhdyqzyiusrivktliuywsytxpbihilgmtlonudnaxuhkxypwnahkql mtcpzdugihctxighzgbyyjitpujkqnitbwpwwrsvvvkqpzzllwxwapqpkwkocnmxnnkwrdrpgvwblrtl ybybnynehxqikxelwhtopgejztqwwxruaplojwfyihbunvmmtqqztfvrperkihifvkobcjypcxngpfie ytgpolihmwfdkrcjkwkoebdcgdqzyqymixqhncybvbdnqksubaryhimvzptvjahmwbzifyrgmprwqgkk edkrrojkpigzojqpqhqdrxlrzqtytrakzkfizjlbuijltoypwlshrrfjnqhmgxrkgzedkeooqpribrpd rmyvbhwowplkkiakbwktopebrmcntrjpbcipirmbpwerlwfqotefguzlhxqixnsmyuwscauakrjiomfj tounfowfrmrauhyhppnt Sample Run Command C or C++ program: prompt> ./hillcipher [login to view URL] hill-16spring-01
Project ID: 14405169

About the project

3 proposals
Remote project
Active 7 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello. How are you today. I have read and understood the project. I have strong knowledge in Data structures, Algorithms Design, Computer Architecture, Operating System and Computer Graphics. And I'm expert in C/C++,C#, Python ,PHP etc. I'm interested in this project. Please send me a message so that we can discuss more. Then I'll be happy. I wait for your good reply. Thanks.
$25 USD in 1 day
5.0 (69 reviews)
5.5
5.5
3 freelancers are bidding on average $27 USD for this job
User Avatar
Hello, my name is Kostas and I am an expert c/c++ developer with an extensive knowledge of algorithms and data structures. Please send me a message to discuss the details. Thank you in advance, Kostas.
$35 USD in 1 day
4.9 (13 reviews)
3.8
3.8
User Avatar
A proposal has not yet been provided
$20 USD in 5 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
kissimmee, United States
5.0
2
Payment method verified
Member since Jun 20, 2017

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.