ch.ethz.ssh2.crypto.cipher
Class DES

java.lang.Object
  extended by ch.ethz.ssh2.crypto.cipher.DES
All Implemented Interfaces:
BlockCipher
Direct Known Subclasses:
DESede

public class DES
extends java.lang.Object
implements BlockCipher

DES.

Version:
$Id: DES.java,v 1.3 2005/12/05 17:13:27 cplattne Exp $ethz.ch
Author:
See comments in the source file

Field Summary
(package private) static int[] bigbyte
           
(package private) static short[] bytebit
           
(package private) static short[] Df_Key
          what follows is mainly taken from "Applied Cryptography", by Bruce Schneier, however it also bears great resemblance to Richard Outerbridge's D3DES...
(package private) static byte[] pc1
           
(package private) static byte[] pc2
           
(package private) static int[] SP1
           
(package private) static int[] SP2
           
(package private) static int[] SP3
           
(package private) static int[] SP4
           
(package private) static int[] SP5
           
(package private) static int[] SP6
           
(package private) static int[] SP7
           
(package private) static int[] SP8
           
(package private) static byte[] totrot
           
private  int[] workingKey
           
 
Constructor Summary
DES()
          standard constructor.
 
Method Summary
protected  void desFunc(int[] wKey, byte[] in, int inOff, byte[] out, int outOff)
          the DES engine.
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.
 java.lang.String getAlgorithmName()
           
 int getBlockSize()
           
 void init(boolean encrypting, byte[] key)
          initialise a DES cipher.
 void reset()
           
 void transformBlock(byte[] in, int inOff, byte[] out, int outOff)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workingKey

private int[] workingKey

Df_Key

static short[] Df_Key
what follows is mainly taken from "Applied Cryptography", by Bruce Schneier, however it also bears great resemblance to Richard Outerbridge's D3DES...


bytebit

static short[] bytebit

bigbyte

static int[] bigbyte

pc1

static byte[] pc1

totrot

static byte[] totrot

pc2

static byte[] pc2

SP1

static int[] SP1

SP2

static int[] SP2

SP3

static int[] SP3

SP4

static int[] SP4

SP5

static int[] SP5

SP6

static int[] SP6

SP7

static int[] SP7

SP8

static int[] SP8
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:
java.lang.IllegalArgumentException - if the params argument is inappropriate.

getAlgorithmName

public java.lang.String getAlgorithmName()

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface BlockCipher

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!).


desFunc

protected void desFunc(int[] wKey,
                       byte[] in,
                       int inOff,
                       byte[] out,
                       int outOff)
the DES engine.