Guest User

StreamXORStringKey

a guest
Nov 27th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. import java.io.*;
  2. public class StreamXORStringKey {
  3.  
  4.     public static void main(String[] args) {
  5.    
  6.     String word = "rhubarb";
  7.     int count = 0;
  8.    
  9.     try {
  10.             byte a;
  11.            
  12.             while((a = (byte)System.in.read())!= -1){
  13.                     System.out.printf("%c", (a ^ word.charAt(count % word.length())));
  14.                     count++;
  15.                 }
  16.         }
  17.         catch(IOException io){
  18.                 io.printStackTrace();
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment