The Source for Java Technology Collaboration

Home » java.net Forums » Java Tools » Java Development Tools

Thread: write this program

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Last Post: Nov 3, 2009 1:40 PM by: peter__lawrey Threads: [ Previous | Next ]
maheshkumarg2

Posts: 1
write this program
Posted: Nov 1, 2009 12:16 PM
  Click to reply to this thread Reply

Write a program Cipher.java that encrypts plain text from a file, using a transposition cipher. The cipher works by 'transposing' the characters of the text, making it difficult to read without knowing the characters' original positions. Conceptually, the text is first arranged into rows, then the columns are rearranged, and each column's contents are output to produce the encrypted message (cipher-text). If there are not enough characters to fill the final row, the remainder should be 'padded' with a space followed by enough random characters to fill the row (this is to ensure that each column is the same length, so decryption would work correctly.)


Your program should read the text from a file (e.g. “plain.txt”), encrypt it, and display the cipher-text. The file will contain some number of lines, each consisting of only lower-case letters (a-z) and spaces (i.e. no upper-case letters and no punctuation.) After encryption, the cipher-text should be displayed on the screen using upper-case letters. The columns should be rearranged in the order: 4,7,3,1,5,2,6.

this is my very
secret message

\/
1 2 3 4 5 6 7
t h i s i s
m y v e r
y s e c r e
t m e s s a
g e e g k r
In rows, padded

\/
4 7 3 1 5 2 6
s s i t h i
r y v m e
e e s y c r
e a m t s s
e r g g e k
Re-order columns

\/
S EEESREARIYSM T YTG
VCSGHM EIERSK

Cipher Text

peter__lawrey

Posts: 188
Re: write this program
Posted: Nov 3, 2009 1:40 PM   in response to: maheshkumarg2
  Click to reply to this thread Reply

You forgot to say how much you pay people to do your home work.

I suggest you try starting yourself and asking a question when you get stuck, you might learn something that way. If you have not time to learn and have left this until the last minute, you can paid someone on a number of coder for hire sites.

good-luck.




 XML java.net RSS