|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sam.cipher.Cipher | +--sam.cipher.DES
Implementation of the DES
cipher
Retrofitted for personal use by Guillaume Lacôte.
DES is a 64-bit block cipher and a key length of 8 bytes, out of which
only 56 bits are used as the parity bit in each byte is ignored.
DES was designed by IBM and first released in 1976. The algorithm is freely usable for both single and triple encryption.
References:
Portions of this code are copyright © 1995-1998
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
Other copyright owners and contributors are:
$Revision: $
Nested Class Summary | |
static class |
DES.Key
Key implementation that is adapted to the DES cipher. |
Nested classes inherited from class sam.cipher.Cipher |
Cipher.ByteArrayFilter, Cipher.Error |
Field Summary |
Fields inherited from class sam.cipher.Cipher |
DECRYPT, EMPTY, ENCRYPT, INVERSE, key, REGISTRY |
Constructor Summary | |
DES(sam.cipher.Key key)
|
Method Summary | |
protected void |
decrypt(byte[] in,
int inOffset,
sam.cipher.Key key)
Decrypt exactly one block of ciphertext. |
protected void |
encrypt(byte[] in,
int inOffset,
sam.cipher.Key key)
Encrypt exactly one block of plaintext. |
protected static void |
FP(int[] io)
Apply in situ the DES FP trnasformation (IP-1) to a DES block. |
int |
getPreferredSize(int size)
The DES preferred size is always 8 |
protected static void |
IP(int[] io)
Apply in situ the DES IP transformation to a DES block. |
Methods inherited from class sam.cipher.Cipher |
cipher, cipher, fill, main, store, store, storeReversed, streamTest, test, unstoreInt, unstoreLong, unstoreReversedLong |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DES(sam.cipher.Key key)
Method Detail |
public int getPreferredSize(int size)
8
getPreferredSize
in class Cipher
size
- proposed buffer size (in bytes)
protected void encrypt(byte[] in, int inOffset, sam.cipher.Key key)
in
- The plaintext.inOffset
- Index of in from which to start considering data.key
- The session key to use for encryption.protected void decrypt(byte[] in, int inOffset, sam.cipher.Key key)
in
- The ciphertext.inOffset
- Index of in from which to start considering data.key
- The session key to use for encryption.protected static void IP(int[] io)
io
- DES block as an array of 32-bit entities.protected static void FP(int[] io)
io
- DES block as an array of 32-bit entities.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |