Class ARCFour


  • public class ARCFour
    extends java.lang.Object
    This class is an implementation of the alleged RC4 algorithm.
    Version:
    $Revision: 1.8 $
    Author:
    Ben Litchfield
    • Constructor Summary

      Constructors 
      Constructor Description
      ARCFour()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setKey​(byte[] key)
      This will reset the key to be used.
      void write​(byte[] data, int offset, int len, java.io.OutputStream output)
      This will encrypt and write the data.
      void write​(byte[] data, java.io.OutputStream output)
      This will encrypt and write the data.
      void write​(byte aByte, java.io.OutputStream output)
      This will encrypt and write the next byte.
      void write​(java.io.InputStream data, java.io.OutputStream output)
      This will encrypt and write the data.
      • Methods inherited from class java.lang.Object

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

      • ARCFour

        public ARCFour()
        Constructor.
    • Method Detail

      • setKey

        public void setKey​(byte[] key)
        This will reset the key to be used.
        Parameters:
        key - The RC4 key used during encryption.
      • write

        public void write​(byte aByte,
                          java.io.OutputStream output)
                   throws java.io.IOException
        This will encrypt and write the next byte.
        Parameters:
        aByte - The byte to encrypt.
        output - The stream to write to.
        Throws:
        java.io.IOException - If there is an error writing to the output stream.
      • write

        public void write​(byte[] data,
                          java.io.OutputStream output)
                   throws java.io.IOException
        This will encrypt and write the data.
        Parameters:
        data - The data to encrypt.
        output - The stream to write to.
        Throws:
        java.io.IOException - If there is an error writing to the output stream.
      • write

        public void write​(java.io.InputStream data,
                          java.io.OutputStream output)
                   throws java.io.IOException
        This will encrypt and write the data.
        Parameters:
        data - The data to encrypt.
        output - The stream to write to.
        Throws:
        java.io.IOException - If there is an error writing to the output stream.
      • write

        public void write​(byte[] data,
                          int offset,
                          int len,
                          java.io.OutputStream output)
                   throws java.io.IOException
        This will encrypt and write the data.
        Parameters:
        data - The data to encrypt.
        offset - The offset into the array to start reading data from.
        len - The number of bytes to attempt to read.
        output - The stream to write to.
        Throws:
        java.io.IOException - If there is an error writing to the output stream.