Class DES

  • All Implemented Interfaces:
    BlockCipher
    Direct Known Subclasses:
    DESede

    public class DES
    extends Object
    implements BlockCipher
    DES.
    Version:
    $Id: DES.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
    Author:
    See comments in the source file
    • Constructor Detail

      • DES

        public DES()
        standard constructor.
    • Method Detail

      • init

        public void init​(boolean encrypting,
                         byte[] key)
        initialise a DES cipher.
        Specified by:
        init in interface BlockCipher
        Parameters:
        encrypting - whether or not we are for encryption.
        key - the parameters required to set up the cipher.
        Throws:
        IllegalArgumentException - if the params argument is inappropriate.
      • getAlgorithmName

        public String getAlgorithmName()
      • transformBlock

        public void transformBlock​(byte[] in,
                                   int inOff,
                                   byte[] out,
                                   int outOff)
        Specified by:
        transformBlock in interface BlockCipher
      • reset

        public void reset()
      • generateWorkingKey

        protected int[] generateWorkingKey​(boolean encrypting,
                                           byte[] key,
                                           int off)
        generate an integer based working key based on our secret key and what we processing we are planning to do.

        Acknowledgements for this routine go to James Gillogly & Phil Karn. (whoever, and wherever they are!).

        Parameters:
        encrypting - the encrypting
        key - the key
        off - the off
        Returns:
        the int [ ]
      • desFunc

        protected void desFunc​(int[] wKey,
                               byte[] in,
                               int inOff,
                               byte[] out,
                               int outOff)
        the DES engine.
        Parameters:
        wKey - the w key
        in - the in
        inOff - the in off
        out - the out
        outOff - the out off