Package com.trilead.ssh2.crypto.cipher
Class DES
java.lang.Object
com.trilead.ssh2.crypto.cipher.DES
- All Implemented Interfaces:
BlockCipher
- Direct Known Subclasses:
DESede
DES.
- Version:
- $Id: DES.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static int[]
(package private) static short[]
(package private) static short[]
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[]
(package private) static byte[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static int[]
(package private) static byte[]
private int[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.int
void
init
(boolean encrypting, byte[] key) initialise a DES cipher.void
reset()
void
transformBlock
(byte[] in, int inOff, byte[] out, int outOff)
-
Field Details
-
workingKey
private int[] workingKey -
Df_Key
static short[] Df_Keywhat 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 Details
-
DES
public DES()standard constructor.
-
-
Method Details
-
init
public void init(boolean encrypting, byte[] key) initialise a DES cipher.- Specified by:
init
in interfaceBlockCipher
- 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
-
getBlockSize
public int getBlockSize()- Specified by:
getBlockSize
in interfaceBlockCipher
-
transformBlock
public void transformBlock(byte[] in, int inOff, byte[] out, int outOff) - Specified by:
transformBlock
in interfaceBlockCipher
-
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 encryptingkey
- the keyoff
- 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 keyin
- the ininOff
- the in offout
- the outoutOff
- the out off
-