Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

Epitaph64

By: a guest on Jun 15th, 2009  |  syntax: Java  |  size: 1.27 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  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() * 7);
  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. }