P. 1
polybeian cipher/Encryption & Decryption Code

polybeian cipher/Encryption & Decryption Code

5.0

|Views: 38|Likes:
Published by Sunil Kumar Reddy
This is a code in JAVA for Polybeian cipher.
ex:- message="beastmaster";
you will have an array of 5*5 which contains all alphabets.
you will encrypt your message by passing the index of particular chracter of your message.
array[5][5]={'a','g','t','e','o',
.................
.................
.................
'b','s','m',...}
the encrypted message now is: "40044103..."
since array[4][0]='b'
array[0][4]='e'
array[1][0]='a'
..............
..............
..............
agian use the same array to get back your original message.
This is a code in JAVA for Polybeian cipher.
ex:- message="beastmaster";
you will have an array of 5*5 which contains all alphabets.
you will encrypt your message by passing the index of particular chracter of your message.
array[5][5]={'a','g','t','e','o',
.................
.................
.................
'b','s','m',...}
the encrypted message now is: "40044103..."
since array[4][0]='b'
array[0][4]='e'
array[1][0]='a'
..............
..............
..............
agian use the same array to get back your original message.

More info:

Published by: Sunil Kumar Reddy on Jul 24, 2008
Copyright:Traditional Copyright: All rights reserved
List Price: $1.00 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
See more
See less

05/09/2014

$1.00

USD

pdf

text

original

/*<applet code = polybeian height = 900 width = 900> </applet>*/ import java.applet.*; import java.awt.

*;

public class polybeian extends Applet { String s = new String("comeon"); StringBuffer sb1 = new StringBuffer(s); StringBuffer sb2 = new StringBuffer(); String s2,s4; char arr[][]={{'a','b','c','d','e'},{'f','g','h','i','j'},{'k','l','m','n','o'},{'p','q','r','s','t'}, {'u','v','w','x','y'}}; String dup; int num; char ch; Label l1 = new Label("encrypted data:"); Label l2 = new Label("after decryption:"); Label l3,l4; public int getindex(char c) { for(int i = 0;i < 5;i++) for(int j = 0;j < 5;j++) if(arr[i][j] == c) return (10*(i+1)+(j+1)); if(c == 'z') return 55; else

int j = x%10.i++) { ch = sb1. dup = new String(Integer. } s2 = new String(sb2).toString(num)).i+1)). sb2 = sb2. StringBuffer sb3 = new StringBuffer(). num = getindex(ch). sb3.length().length().setLength(s.i < sb1. . int x = Integer.append(dup).charAt(i).parseInt(s3). } public void init() { for(int i = 0.length()).return 0. for(int i = 1. } public char getcharval(int x) { int i = x/10. //DECRYPTION int j = 0.substring(i-1. return arr[i-1][j-1].i < sb2.i = i+2) { String s3 = new String(s2.

add(l2). add(l4). l3 = new Label(s2).c). add(l1). add(l3).char c = getcharval(x). sb3. } s4= new String(sb3). l4 = new Label(s4). } public void paint(Graphics g) { } } .setCharAt(j++.

You're Reading a Free Preview

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