• Post Reply Bookmark Topic Watch Topic
  • New Topic

how am i able to create a code with this code encrypted message  RSS feed

 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Skipping Strings

Description

Sue Spicious likes to communicate with her friends on social network sites, but she knows that these sites aren’t very secure, and she also doesn’t like the way that the sites’ owners tend to assert ownership over all content. Her messages aren’t likely to be of interest to many others, but she’s not interested in having them data-mined by e-commerce companies.

To provide some simple protection against the data-miners, Sue encodes all of her messages through a scrambling procedure, which operates separately on each line of her message. Sue starts with the number 16, the age when she and her friends met, and pulls out every 16th character of the line, placing these characters in order at the beginning of her coded line of text. Then she halves the number, and pulls out every 8th character of the remaining characters of the line. She continues in this way for every 4th character and 2nd character, and then finally adds the remaining characters to the end of her coded line of text.

You are Sue’s friends and you want to help her encode her messages. To do this, you need to write a program to generate an encrypted version of Sues message.

Input Format

The input consists of lines of text from a text file, where each line contains from 1 to 80 characters, and is terminated by a newline ’\n’ character. The input ends with an empty line (newline character only). Each line is a line of Sue’s message.

Output Format

The output consists of the scrambled message, line by line.

Input

0123456789abcdef
This is only a test for you to read.
Sue wouldn’t post the important messages where you can see them.
Even encrypted ones.

Output

f738c146ad0259be
tr eyaso tr eh slasf uodTiiny oot .
s y.ltpew d titmgh aeeuwu’p emrnsaseeunstmSeontoh oatse roc eh
ocnnresv npde Eeeyt .

Note:

• Your program should have a separate method that will extract the letters, encrypt and return the encrypted version of Sue’s message line by line.
• Sues message is in the text file named skipping_input.txt.
• Aside from displaying the encrypted message of Sue in the screen your program is also required to create a backup in a text file named skipping_output.txt.
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

/*
* Name:Kurt Ullmer B. Marfori
* Date:January 11,2012
* Description: Skipping_String
*
*/
import java.util.*;
import java.io.*;

public class Skipping_String
{
public static void main (String [] args)throws IOException
{
FileReader br = new FileReader("skipping_input.txt");
FileWriter bw = new FileWriter("skipping_output.txt");
BufferedReader line = new BufferedReader(br);
String data = line.readLine();

for(int i = 1; i <= 1; i++){
{

}

while(i<=4){

System.out.println();

{
String getdata = three(data);
System.out.print(""+ getdata );
data = line.readLine();
}
i++;
}
System.out.println();
System.out.println();
System.out.println();
}






bw.close();
br.close();

}



public static String three(String amount){
String multiply = amount;
StringTokenizer v = new StringTokenizer(multiply,"\n");
String s = v.nextToken();
return s;
}

}
this is the only code i have created and there are too many code to be added since this is only show the file
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what's your question? You need to TellTheDetails(⇐link). Also, make sure to UseCodeTags(⇐link) when posting code.
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:So, what's your question? You need to TellTheDetails(⇐link). Also, make sure to UseCodeTags(⇐link) when posting code.

my problem and the details are stated in my first post jeff i just wanna know what am i going to do next to the code i've made which is this:
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kurt marfori wrote:
Jeff Verdegan wrote:So, what's your question? You need to TellTheDetails(⇐link). Also, make sure to UseCodeTags(⇐link) when posting code.

my problem and the details are stated in my first post jeff i just wanna know what am i going to do next to the code i've made which is this:


That's not details. That's "How do I do my homework?" and it's far too broad a question to be answered here in any detail. At the high level, you look at the requirements, pick one, or a small part of one, and figure out how to implement it. For instance, pulling out every 16th character from a line. Try doing just that, nothing else, and if you get stuck, post again, providing details.

I also strongly suggest you read this and heed its advice: http://home.earthlink.net/~patricia_shanahan/beginner.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!