net.sourceforge.jtds.util

Class DESEngine


public class DESEngine
extends java.lang.Object

a class that provides a basic DES engine. Modified by Matt Brinkley (mdb) ... mainly just removed depends on external classes.
Version:
$Id: DESEngine.java,v 1.3 2004/09/16 20:40:51 matt_brinkley Exp $

Field Summary

protected static int
BLOCK_SIZE
(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 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 int[]
bigbyte
(package private) static short[]
bytebit
(package private) static byte[]
pc1
(package private) static byte[]
pc2
(package private) static byte[]
totrot
private int[]
workingKey

Constructor Summary

DESEngine()
standard constructor.
DESEngine(boolean encrypting, byte[] key)
mdb: convenient 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)
generate an integer based working key based on our secret key and what we processing we are planning to do.
String
getAlgorithmName()
int
getBlockSize()
void
init(boolean encrypting, byte[] key)
initialise a DES cipher.
int
processBlock(byte[] in, int inOff, byte[] out, int outOff)
void
reset()

Field Details

BLOCK_SIZE

protected static final int BLOCK_SIZE
Field Value:
8

Df_Key

(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...

SP1

(package private) static int[] SP1

SP2

(package private) static int[] SP2

SP3

(package private) static int[] SP3

SP4

(package private) static int[] SP4

SP5

(package private) static int[] SP5

SP6

(package private) static int[] SP6

SP7

(package private) static int[] SP7

SP8

(package private) static int[] SP8

bigbyte

(package private) static int[] bigbyte

bytebit

(package private) static short[] bytebit

pc1

(package private) static byte[] pc1

pc2

(package private) static byte[] pc2

totrot

(package private) static byte[] totrot

workingKey

private int[] workingKey

Constructor Details

DESEngine

public DESEngine()
standard constructor.

DESEngine

public DESEngine(boolean encrypting,
                 byte[] key)
mdb: convenient constructor

Method Details

desFunc

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

generateWorkingKey

protected int[] generateWorkingKey(boolean encrypting,
                                   byte[] key)
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!).

getAlgorithmName

public String getAlgorithmName()

getBlockSize

public int getBlockSize()

init

public void init(boolean encrypting,
                 byte[] key)
initialise a DES cipher.
Parameters:
encrypting - whether or not we are for encryption.
key - the parameters required to set up the cipher.

processBlock

public int processBlock(byte[] in,
                        int inOff,
                        byte[] out,
                        int outOff)

reset

public void reset()

Generated on June 12 2008