title: What is the escape sequence for a space OR assist with my hash function?
body: <p>I've looked everywhere and I can't seem to find the escape sequence for a space. I'm currently using " " for space but it's not working. I need it for my hash function which fails to compute properly when it hashes a password that includes a space character. </p>
  
  <p>For example when I input "aaa aaa" into my program, it outputs ">&amp;q". My function should output a seven character hash based on the password, but it stops at the space instead, leaving only a three character output. However, the function can still output a space given certain inputs. </p>
  
  <pre><code>import java.util.*;
  
  public class Hasher {
  
      private static Scanner scan;
  
      /*
       * This function will generate a hash based off a password entered by the
       * user
       */
      public static void main(String[] args) {
  
          scan = new Scanner(System.in);
  
          System.out.println("What is your password?");
  
          String password = scan.next();
  
          String characters = "qwertyuiopasdfghjklzxcvbnm";
          characters = characters + characters.toUpperCase();
          characters = characters + "1234567890";
          characters = characters + " ";
          characters = characters + "!@#$%^&amp;*()_+-=`~\b[]?-{};',./:\"&lt;&gt;?\\";
  
          char[] array = new char[2 * characters.length()];
  
          for (int y = 0; y &lt; array.length; y++) {
  
              Random rand = new Random(y);
              array[y] = characters.charAt(rand.nextInt(characters.length()));
          }
  
          String newPass = "";
  
          for (int y = 0; y &lt; password.length(); y++) {
  
              char x = password.charAt(y);
  
              for (int z = 0; z &lt; characters.length(); z++) {
  
                  if (x == characters.charAt(z)) {
  
                      Random rand = new Random(y);
                      x = array[z + rand.nextInt(array.length - z)];
                      newPass = newPass + x;
                      break;
                  }
              }
          }
  
          System.out.println("Your hash is: " + newPass);
  
      }
  
  }
  </code></pre>