decode coded message, using matrix and coding commands

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)
 
kkissofdeath said:
I Know Its A 1 Word Answer Any1 Willin To Have A Go To Help Me Out?
This Is [not] Homework Or Nothing
The fact that (you claim that) this is not homework does not mean that this math (not programming) homework-help service has suddenly turned into a programming-for-hire-but-we'll-really-work-on-demand-for-free sort of place. :shock: I apologize for the confusion. :?

If you're wanting somebody to help you with your coding puzzles, then go to a puzzles place, and show some work of your own, rather than just dumping it in their laps and making high-handed demands.
nono.gif


If, on the other hand, you're not willing to contribute anything positive to the process, then go find a coding company or web site, and pay for the service you're requiring.
popcorn.gif


By the way, multi-post (and no work shown there, either). :roll:

Eliz.
 
Yes I Understand What This Site Is About I Think This Was Covered In School By Some1

I Just Didnt Do This Course

So I Figured What Might Be Hard For Me Would Be Easy For You?


I Honestly Cannot Tell You What Attempts Ive Tried

When I Feel Like Im Getting Close To An Answer It Just Slips Away :(


Yes I Am Determained To Have This Solved So i Posted This Everywhere I Could Think Of



The Language Is Java
 
Top