• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to encrypt a message using the string skipper

 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wanna know on how to get a program using string skipping:
With a Filereader and a Filewritter :

Input is:
0123456789abcdef
This is only a list for you to read
Sue wouldn't post the important message where you can see them
Even encrypted ones

First you have to get the 16 character and then get the the halves of the line so 8 character the get next the 4 character then 2 and so fort.





 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This forum is for Spring Framework questions. I don't think your question is related to Spring. So I am going to move this to the IO forum because you are talking about readers writers.

Please make sure you post in the most appropriate forum about your question. It will ensure you get a quicker more accurate response.

Thanks

Mark
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kurt, welcome to the Ranch!

It's not really clear what you are asking. Can you show a couple examples of what you're talking about?

Also, you should be aware that encryption that relies on the enemy not knowing your encryption algorithm is essentially useless. Always assume the enemy knows what algorithm you're using, and use one that is based on a key, whether it's a symmetric encryption or public/private key pair or whatever.

Of course, if this is just for study where the actual encryption isn't the issue and doesn't need to be really secure, then don't worry about that part.
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:Kurt, welcome to the Ranch!

It's not really clear what you are asking. Can you show a couple examples of what you're talking about?

Also, you should be aware that encryption that relies on the enemy not knowing your encryption algorithm is essentially useless. Always assume the enemy knows what algorithm you're using, and use one that is based on a key, whether it's a symmetric encryption or public/private key pair or whatever.

Of course, if this is just for study where the actual encryption isn't the issue and doesn't need to be really secure, then don't worry about that part.


thanks for all your replies ill just post later the problem and my sample output.It's like scrambling of some character.
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:Kurt, welcome to the Ranch!

It's not really clear what you are asking. Can you show a couple examples of what you're talking about?

Also, you should be aware that encryption that relies on the enemy not knowing your encryption algorithm is essentially useless. Always assume the enemy knows what algorithm you're using, and use one that is based on a key, whether it's a symmetric encryption or public/private key pair or whatever.

Of course, if this is just for study where the actual encryption isn't the issue and doesn't need to be really secure, then don't worry about that part.


Thanks Jeff..I'll just post later a couple of examples and the output of the input i've given yesterday..hope you could come up with a code a soon as i state it clearly what really the problem is.
Thanks again
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Spritzler wrote:This forum is for Spring Framework questions. I don't think your question is related to Spring. So I am going to move this to the IO forum because you are talking about readers writers.

Please make sure you post in the most appropriate forum about your question. It will ensure you get a quicker more accurate response.

Thanks

Mark

Thanks for the reply Mark.Sorry for the lack of information that i have posted.I'll just post later some examples and the output of the input i have given and hoping the you could come up with a code. This problem is related to spring.
 
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
kurt marfori wrote: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.


This is the correct problem.I find it difficult to solve how am i going to do this..
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Skipping_string.java

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();

{


data = line.readLine();
char i=first_line(data);
System.out.println("" +i );

}





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

}
public static char first_line( String i){
String first_line;
int converted;
char result;
first_line=i;
converted=first_line.length();
result=first_line.charAt(20);
return result;


}

}
 
kurt marfori
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kurt marfori wrote:Skipping_string.java

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();

{


data = line.readLine();
char i=first_line(data);
System.out.println("" +i );

}





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

}
public static char first_line( String i){
String first_line;
int converted;
char result;
first_line=i;
converted=first_line.length();
result=first_line.charAt(20);
return result;


}

}

this is the only code ive started and i think even this is wrong..please help me experts
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!