Class XORCipher

  • All Implemented Interfaces:
    CryptoFilter

    public class XORCipher
    extends java.lang.Object
    implements CryptoFilter
    Example encryption filter that XOR's the all data with a secret seed value.
    • Constructor Summary

      Constructors 
      Constructor Description
      XORCipher​(java.lang.String seed)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read​(java.io.InputStream in)  
      int read​(java.io.InputStream in, byte[] b)  
      int read​(java.io.InputStream in, byte[] b, int off, int len)  
      void reset()  
      java.lang.String toString()  
      void write​(java.io.OutputStream out, int ch)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • XORCipher

        public XORCipher​(java.lang.String seed)
    • Method Detail

      • read

        public int read​(java.io.InputStream in)
                 throws java.io.IOException
        Specified by:
        read in interface CryptoFilter
        Throws:
        java.io.IOException
      • read

        public int read​(java.io.InputStream in,
                        byte[] b)
                 throws java.io.IOException
        Specified by:
        read in interface CryptoFilter
        Throws:
        java.io.IOException
      • read

        public int read​(java.io.InputStream in,
                        byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Specified by:
        read in interface CryptoFilter
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • write

        public void write​(java.io.OutputStream out,
                          int ch)
                   throws java.io.IOException
        Specified by:
        write in interface CryptoFilter
        Throws:
        java.io.IOException