gnu.crypto.cipher

Class TripleDES

public class TripleDES extends BaseCipher

Triple-DES, 3DES, or DESede is a combined cipher that uses three iterations of the Data Encryption Standard cipher to improve the security (at the cost of speed) of plain DES.

Triple-DES runs the DES algorithm three times with three independent 56 bit keys. To encrypt:

Ci = Ek3 ( Ek2-1 ( Ek1 ( Pi )))

And to decrypt:

Pi = Ek1-1 ( Ek2 ( Ek3-1 ( Ci )))

(The "ede" comes from the encryption operation, which runs Encrypt-Decrypt-Encrypt)

References:

  1. Bruce Schneier, Applied Cryptography: Protocols, Algorithms, and Source Code in C, Second Edition. (1996 John Wiley and Sons) ISBN 0-471-11709-9. Page 294--295.

Version: $Revision: 1.2 $

Field Summary
static intBLOCK_SIZE
Triple-DES only operates on 64 bit blocks.
static intKEY_SIZE
Triple-DES uses 168 bits of a parity-adjusted 192 bit key.
Constructor Summary
TripleDES()
Default 0-arguments constructor.
Method Summary
static voidadjustParity(byte[] kb, int offset)
Transform a key so it will be parity adjusted.
IteratorblockSizes()
Objectclone()
voiddecrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)
voidencrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)
static booleanisParityAdjusted(byte[] kb, int offset)
Tests if a byte array has already been parity adjusted.
IteratorkeySizes()
ObjectmakeKey(byte[] kb, int bs)

Field Detail

BLOCK_SIZE

public static final int BLOCK_SIZE
Triple-DES only operates on 64 bit blocks.

KEY_SIZE

public static final int KEY_SIZE
Triple-DES uses 168 bits of a parity-adjusted 192 bit key.

Constructor Detail

TripleDES

public TripleDES()
Default 0-arguments constructor.

Method Detail

adjustParity

public static void adjustParity(byte[] kb, int offset)
Transform a key so it will be parity adjusted.

Parameters: kb The key bytes to adjust. offset The starting offset into the key bytes.

See Also: (byte[],int)

blockSizes

public Iterator blockSizes()

clone

public Object clone()

decrypt

public void decrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)

encrypt

public void encrypt(byte[] in, int i, byte[] out, int o, Object K, int bs)

isParityAdjusted

public static boolean isParityAdjusted(byte[] kb, int offset)
Tests if a byte array has already been parity adjusted.

Parameters: kb The key bytes to test. offset The starting offset into the key bytes.

Returns: true if the bytes in kb starting at offset are parity adjusted.

See Also: (byte[],int) (byte[],int)

keySizes

public Iterator keySizes()

makeKey

public Object makeKey(byte[] kb, int bs)
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.