-4

So this is my first post, and I was looking for some help in encrypting a string. This is almost certainly way above my level, but I decided to take it on as a challenge. Anyway, to the code:

    Scanner keyboard = new Scanner(System.in);
    System.out.print("Please type a string to be encoded: ");
    char input;
    input = keyboard.nextChar();
    System.out.println("Your string was: "+input);

So this is what I've got so far, just a few simple lines that take a string, and give it back to you. What I would like to know is:

  1. Is this a good starting point to work from?
  2. What steps should I take next to encode the string?
FoxMod
  • 1
  • 1

1 Answers1

-1

Your code is a good start. However, I would declare input as a String and get the .nextString (so the user can type more than one character).

There are many, many, many ways to encrypt. Here are some possibilities you could try:

  • If you are feeling very adventurous or want the top-of-the-line encryption method, you could research AES (Advanced Encryption Standard).

  • I would recommend something simpler, such as the Polyalphabetic Substitution Cipher (more well-known as the Enigma). Although it may seem difficult, it is not very hard to do.

  • If you are not experienced with cryptology, I would first try a simple subsitution cipher. Then, you can move on to more difficult encryption methods.

I am no cryptologist, but if you want to design your own encryption method, make sure it involves some sort of key, or password. You will also want to make sure that it can be decrypted easily as well.

AMACB
  • 1,290
  • 2
  • 18
  • 26
  • His code isn't a good start, it literally only reads a character, it doesn't even read a string. OP's questions could easily have been answered himself by even doing a little bit of googling instead of coming straight here with code that doesn't even REMOTELY come close to doing what he wants – user1231232141214124 Jan 15 '16 at 00:13
  • I addressed that in my answer. Also, his question is asking about encryption, not code. – AMACB Jan 15 '16 at 00:17
  • All of this could have been found with a simple google search by OP. It is expected that people do some precursory research before coming here for help, which @FoxMod clearly has not done. – user1231232141214124 Jan 15 '16 at 00:44