in java File encryption is the science of writing the contents of a file in a secret...

70.2K

Verified Solution

Question

Programming

in java

File encryption is the science of writing the contents of a filein a secret code. Write an encryption program that works like afilter, reading the contents of one file, modifying the data into acode, and then writing the coded contents out to a second file. Thesecond file will be a version of the first file, but written in asecret code. Although there are complex encryption techniques, youshould come up with a simple one of your own. For example, youcould read the first file one character at a time, and add 10 tothe character code of each character before it is written to thesecond file.

Write a second program that decrypts the file produced by theprogram. The decryption program should read the contents of thecoded file, restore the data to its original state, and write it toanother file.

Hint: Store the files in .txt format and use the readByte() andwriteByte() methods.

Answer & Explanation Solved by verified expert
4.5 Ratings (902 Votes)
PrograminputtxtSample outputEncryptedFiletxtDecryptedFiletxtCode to copyimport javaioFileimport javaioFileInputStreamimport javaioFileNotFoundExceptionimport javaioFileOutputStreamimport javaioIOExceptionimport javautilScannerpublic classEncryptFileDatapublicstatic void mainString argsthrowsIOException FileNotFoundException    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students