Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java : File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a
Java : File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will be a version of the first file, but written in secret code. Use text (ASCII) files for this exercise. Create another program to read and decrypt the contents of the coded file, restore the data to its original state, and display the original data to the user. Although there are complex encryption techniques, you should come up with a simple one of your own. For example, you could read the first file one character at a time, and add 10 to the character code of each character before it is written to the second file. This is called a shift-cypher. Your cipher code should make sure that it encodes the data into valid characters and the decryption code should expect to decipher valid characters back into the original data. Please refer to Appendix 3 of your text to see the int values for the valid ASCII printable characters. The biggest int value in ASCII is 255 and the smallest is 0. You will need to take this into consideration when deciding on your encryption technique. For example, multiplying n * 3 would result in an invalid character as the ASCII code for n is 110. This would give you 330 which is out-of-bounds for the 8 bit character. To make sure your values never exceed the max of 255 or the min of 0, you may find the mod operator is helpful
Java :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started