pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Java pastebin - collaborative debugging tool View Help


Posted by Epitaph64 on Mon 15 Jun 23:13 (modification of post by Epitaph64 view diff)
report abuse | download | new post

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package encrypttext;
  7.  
  8. /**
  9.  *
  10.  * @author Walter
  11.  */
  12. public class Main {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.  
  19.         String inputString = "So, I'm pretty bored now, how about you?";
  20.         String outputString = "";
  21.         String originalString = "";
  22.         byte encryptionArray[] = new byte[128];
  23.         for (int i = 0; i < 128; i++)
  24.         {
  25.             encryptionArray[i] = (byte) (Math.random() * 128);
  26.         }
  27.         for (int i = 0; i < inputString.length(); i++)
  28.         {
  29.             char x = inputString.charAt(i);
  30.             x ^= encryptionArray[i%128];
  31.             outputString += x;
  32.         }
  33.         System.out.println(outputString);
  34.         for (int i = 0; i < outputString.length(); i++)
  35.         {
  36.             char x = outputString.charAt(i);
  37.             x ^= encryptionArray[i%128];
  38.             originalString += x;
  39.         }
  40.         System.out.println(originalString);
  41.         String key = "";
  42.         for (int i = 0; i < 128; i++)
  43.         {
  44.             key += encryptionArray[i] + " ";
  45.         }
  46.         System.out.println("\n Your key is: " + key);
  47.     }
  48.  
  49. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post