Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
17Activity
×
0 of .
Results for:
No results containing your search query
P. 1
Rail – Fence Cipher

Rail – Fence Cipher

Ratings: (0)|Views: 6,762|Likes:
Published by Dil Prasad Kunwar
Rail – Fence Cipher Implementation using Java.
Rail – Fence Cipher Implementation using Java.

More info:

Published by: Dil Prasad Kunwar on Apr 11, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

04/14/2013

pdf

text

original

 
Name: Dil Prasad Kuwor Date: 9/27/2010Roll no. : 064/02Subject: CryptographyAssignment no. : Lab No. 2
1
Q.5
Encrypt the text “WE ARE DISCOVERED FLEE AT ONCE”, to Rail –
Fence Cipher, using 3rails.
Cipher Text: - WECRL TEERD SOEEF EAOCA IVDEN 
Java Code:
import java.util.*;class RailFenceCipher{public static void main (String[] args){Scanner in = new Scanner(System.in);int i=0,j,l,r,s,c=0,t=0;String plainText=" ",cipherText="";System.out.println("******RAIL-FENCE CIPHER******");System.out.println("Enter the plaintext:");plainText=in.nextLine();System.out.println("Enter the Rails:");r=in.nextInt();l=plainText.length()/r;s=2*l;char ct[][]=new char [r][s];while(i<r){ct[i][c]=plainText.charAt(t);t++;if(i==r-1&&t<=plainText.length()-1){c=c+1;for(j=r-2;j>=0;j--){ct[j][c]=plainText.charAt(t);t++;if(j==0&&t<=plainText.length()-1){c++;i=0;}}}i=i+1;}for(i=0;i<r;i++){for(j=0;j<ct[i].length;j++)

Activity (17)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Prianca Singh liked this
Nisfu Asrul Sani liked this
danut89 liked this
Yakul Bhambri liked this
Priyanka Sharma liked this
sindhu_kavi liked this
sindhu_kavi liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->