kkissofdeath
New member
- Joined
- Feb 6, 2008
- Messages
- 2
public class harness {
public static void main(String[] args) {
int[][] key = {{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
int direction = 1;
int[] primes = {2,3,5,7,11,13,17,19};
String plainString = new String("I PUT THE TEXT IN HERE");
char[] plainCharArray = plainString.toCharArray();
int[] plainIntArray = new int[plainCharArray.length];
int[] cipherIntArray = new int[plainCharArray.length];
char[] cipherCharArray = new char[plainCharArray.length];
for(int x =0; x<plainIntArray.length; x++)
plainIntArray[x] = (int)plainCharArray[x] -97;
for(int x = 0; x < plainIntArray.length; x++){
int k = 0;
for(int y = 0; y <8; y++){
k+= key[y][x%primes[y]] %26;
}
cipherIntArray[x] = (plainIntArray[x] +direction*k +260)%26;
}
for(int x =0; x< cipherIntArray.length; x++)
cipherCharArray[x] = (char)(cipherIntArray[x] +97);
String myString = new String(cipherCharArray);
System.out.println(myString);
}
}
for decription you enter the ciphertext at the same place, and you set direction to -1
the key is that matrix, the 1's are spots that can be entered, and the spots that are 0 do not change
by the way, everything is lowercase and there are no spaces
here is what is generated by encrypting my message to you guys:
charsxrowtrvizrrcvnlcftgdkhhnafgewhefszmfdwvqmvujqflkpapjwwhobliliodhlawtkkjwgzzhdzcqqxuywfwuhvaultavvemlfvmvoewlpqsjybrlrpdtnluyixodgahozgiswirvvikyhmeacnxhxpcfefptagvukxzumqlpshprzfsjrgvhjqmijbqrehcnavwalyuyxfluvvayseqmkaalvzkyvpflfxafywgcmhlfeaykncgguvlttziuwwjapupyublggnkygaasam
I Know Its A 1 Word Answer Any1 Willin To Have A Go To Help Me Out?
This Is Homework Or Nothing (Im Finished With School)
public static void main(String[] args) {
int[][] key = {{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};
int direction = 1;
int[] primes = {2,3,5,7,11,13,17,19};
String plainString = new String("I PUT THE TEXT IN HERE");
char[] plainCharArray = plainString.toCharArray();
int[] plainIntArray = new int[plainCharArray.length];
int[] cipherIntArray = new int[plainCharArray.length];
char[] cipherCharArray = new char[plainCharArray.length];
for(int x =0; x<plainIntArray.length; x++)
plainIntArray[x] = (int)plainCharArray[x] -97;
for(int x = 0; x < plainIntArray.length; x++){
int k = 0;
for(int y = 0; y <8; y++){
k+= key[y][x%primes[y]] %26;
}
cipherIntArray[x] = (plainIntArray[x] +direction*k +260)%26;
}
for(int x =0; x< cipherIntArray.length; x++)
cipherCharArray[x] = (char)(cipherIntArray[x] +97);
String myString = new String(cipherCharArray);
System.out.println(myString);
}
}
for decription you enter the ciphertext at the same place, and you set direction to -1
the key is that matrix, the 1's are spots that can be entered, and the spots that are 0 do not change
by the way, everything is lowercase and there are no spaces
here is what is generated by encrypting my message to you guys:
charsxrowtrvizrrcvnlcftgdkhhnafgewhefszmfdwvqmvujqflkpapjwwhobliliodhlawtkkjwgzzhdzcqqxuywfwuhvaultavvemlfvmvoewlpqsjybrlrpdtnluyixodgahozgiswirvvikyhmeacnxhxpcfefptagvukxzumqlpshprzfsjrgvhjqmijbqrehcnavwalyuyxfluvvayseqmkaalvzkyvpflfxafywgcmhlfeaykncgguvlttziuwwjapupyublggnkygaasam
I Know Its A 1 Word Answer Any1 Willin To Have A Go To Help Me Out?
This Is Homework Or Nothing (Im Finished With School)