Share Pastebin
Guest
Public paste!

Epitaph64

By: a guest | Jun 15th, 2009 | Syntax: Java | Size: 1.27 KB | Hits: 44 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  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. }