Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 how to decipher a piece of text message using java?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nishanthan




PostPosted: Mon Jan 22, 2007 1:51 pm   Post subject: how to decipher a piece of text message using java?

HERE IS THE CODE >>LET ME C IF U COULD DECrypT it


STPXBVMETPMSLGTPUBTPFBPROCUVMCUGTPZBVOTPROBVQTPBPTPIGSPRTPCIMGTPUBTPEGFOZQUTPUJSATPNGAACRGTPTPZBVTPQGBQMGTPJCWGTPAVFFGAAHVMMZTPQCAAGETPUJSATPAVNNCUSWGTPTPZBVTPAJBVMETPIGTPQOBVETPUJCUTPZBVTPRBTPUJSATPHCOTPTPWGOZTPSNQOGAASWGTPTPSTPXSAJTPZBVTPCMMTPUJGTPIGAU
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Mon Jan 22, 2007 3:56 pm   Post subject: Re: how to decipher a piece of text message using java?

errr... no?

is this something you need help on?

if so, there are many topics about encryption and decryption around the site, search around for them.
if you do need help, post up a portion of the code you've tried and we'll see if we can't help you. Very Happy
TheFerret




PostPosted: Mon Jan 22, 2007 4:02 pm   Post subject: RE:how to decipher a piece of text message using java?

Do your own damned work and don't rely on the forum members to do it...
Dan




PostPosted: Mon Jan 22, 2007 4:31 pm   Post subject: RE:how to decipher a piece of text message using java?

If you where meant to decrypt it, it is probly just a simple Shift Cipher or Substitution Cipher. However if this is for a corse on encription and is more advaced it could also be a Permutation Cipher, Hill Cipher, ect.

In the case of shift or subsitiution you can do a simple statical anyasic of the cipher text based on the english langue or simple try random keys if it is just a shift cipher.

It whould help to know what kind of cipher is being used as that will make it much easer to find a way to atack it.

Just looking at it shows you that the text is only A-Z and there are no spaces. This should give you an idea of the keyspace.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
nishanthan




PostPosted: Mon Jan 22, 2007 4:35 pm   Post subject: Re: how to decipher a piece of text message using java?

yo man...i tried ...i just can't figure it out...if u want i could show u wat i did so far...so yea
nishanthan




PostPosted: Mon Jan 22, 2007 6:34 pm   Post subject: RE:how to decipher a piece of text message using java?

here this is all i did so far..

import java.io.*;

public class CryptoQ2
{
public static void main (String[] args) throws IOException
{
BufferedReader br = new BufferedReader (new FileReader ("message.txt"));
BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
String alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String keyword = null;
String msgtxt = br.readLine ();

System.out.println ("Please input the keyword");
keyword = in.readLine ();
keyword = keyword.toUpperCase ();
System.out.println (msgtxt);

alph = scrambled_text (keyword, alph);
System.out.println (alph);

msgtxt = decryption (alph, msgtxt);

msgtxt = message_unparser (msgtxt);
System.out.println (msgtxt);
}


public static String scrambled_text (String key, String alphabet)
{
// Write code to create the scrambled alpha here
// 'key' is the keyword that will be used to create the new scrambled alphabet - 'Degrobois' will be used in this case
// 'alphabet' is the unscrambled alphabet from A to Z that needs to be scrambled

//int a = key.length();
String newkey = key + alphabet;
//int b = newkey.length();

for (int i=0; i<newkey.length(); i++)
{
for (int x=i+1; x<newkey.length(); x++)
{
if (newkey.charAt(i) == newkey.charAt(x))
{

newkey = (newkey.substring(0, x) + newkey.substring(x+1));



}

}
}



return newkey;

}


public static String decryption (String key, String message)
{
// Write code to decrypt the message based on the provided key - the new alphabet based on the keyword 'Degrobois'
// 'key' is the scrambled alphabet, and 'message' is the encrypted message


return message;
}


public static String message_unparser (String message)
{
//This method replaces the letter combination QN was a blank space. QN was the combination chosen to represent a blank space.
//This method does not need to be altered.

message = message.replaceAll ("QNQN", ". ");
message = message.replaceAll ("QN", " ");
message = message + '.';
return message;
}
}
Dan




PostPosted: Mon Jan 22, 2007 6:34 pm   Post subject: Re: how to decipher a piece of text message using java?

nishanthan @ 22nd January 2007, 4:35 pm wrote:
yo man...i tried ...i just can't figure it out...if u want i could show u wat i did so far...so yea


That whould be helpfull, also if you told us more about the problem. Like is this home work, some thing you found on a site some where, ect....
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
ericfourfour




PostPosted: Mon Jan 22, 2007 6:50 pm   Post subject: Re: RE:how to decipher a piece of text message using java?

Here, I reformatted your code. You should try to stick to Java coding conventions (I think there is a link in the tutorials section somewhere). This will make programming a lot more understandable for you and others.

Java:

import java.io.*;

public class CryptoQ2 {
    public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader (new FileReader ("message.txt"));
        BufferedReader in = new BufferedReader (new InputStreamReader (System.in));
        String alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        String keyword = null;
        String msgtxt = br.readLine ();
       
        System.out.println ("Please input the keyword");
        keyword = in.readLine ();
        keyword = keyword.toUpperCase ();
        System.out.println (msgtxt);
       
        alph = scrambled_text (keyword, alph);
        System.out.println (alph);
       
        msgtxt = decryption (alph, msgtxt);
       
        msgtxt = message_unparser (msgtxt);
        System.out.println (msgtxt);
    }
   
   
    public static String scrambled_text (String key, String alphabet) {
        // Write code to create the scrambled alpha here
        // 'key' is the keyword that will be used to create the new scrambled alphabet - 'Degrobois' will be used in this case
        // 'alphabet' is the unscrambled alphabet from A to Z that needs to be scrambled
       
        //int a = key.length();
        String newkey = key + alphabet;
        //int b = newkey.length();
       
        for (int i=0; i<newkey.length (); i++) {
            for (int x=i+1; x<newkey.length (); x++) {
                if (newkey.charAt (i) == newkey.charAt (x)) {
                   
                    newkey = (newkey.substring (0, x) + newkey.substring (x+1));
                   
                   
                   
                }
               
            }
        }
       
       
       
        return newkey;
       
    }
   
   
    public static String decryption (String key, String message) {
        // Write code to decrypt the message based on the provided key - the new alphabet based on the keyword 'Degrobois'
        // 'key' is the scrambled alphabet, and 'message' is the encrypted message
       
       
        return message;
    }
   
   
    public static String message_unparser (String message) {
        //This method replaces the letter combination QN was a blank space.  QN was the combination chosen to represent a blank space.
        //This method does not need to be altered.
       
        message = message.replaceAll ("QNQN", ".  ");
        message = message.replaceAll ("QN", " ");
        message = message + '.';
        return message;
    }
}
Sponsor
Sponsor
Sponsor
sponsor
nishanthan




PostPosted: Mon Jan 22, 2007 11:03 pm   Post subject: RE:how to decipher a piece of text message using java?

hacker dan.....lolz thxx..ye it's a home work...actually its ma project so yea.....that was helpfulll.......thxx

if i have more problemz i'lll ask dun worry Razz

thx again
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: