Recent Posts
C# | 2 sec ago
None | 12 sec ago
PHP | 43 sec ago
Java | 1 min ago
Java | 1 min ago
PHP | 1 min ago
Perl | 2 min ago
None | 2 min ago
PHP | 2 min ago
C++ | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Epitaph64 on the 15th of Jun 2009 11:07:51 PM Download | Raw | Embed | Report
  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. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: