sam.cipher
Class Serpent

java.lang.Object
  |
  +--sam.cipher.Cipher
        |
        +--sam.cipher.Serpent

public class Serpent
extends Cipher

Implementation of the Serpent cipher. Retrofitted for personal use by Guillaume Lacôte. Copyright (c) 1997, 1998 Systemics Ltd on behalf of the Cryptix Development Team. All rights reserved. A bit-slice implementation in Java of the Serpent cipher.

Serpent is a 128-bit 32-round block cipher with variable key lengths, including 128-, 192- and 256-bit keys conjectured to be at least as secure as three-key triple-DES.

Serpent was designed by Ross Anderson, Eli Biham and Lars Knudsen as a candidate algorithm for the NIST AES Quest.

References:

  1. Serpent: A New Block Cipher Proposal. This paper was published in the proceedings of the "Fast Software Encryption Workshop No. 5" held in Paris in March 1998. LNCS, Springer Verlag.

  2. Reference implementation of the standard Serpent cipher written in C by Frank Stajano.

Copyright © 1997, 1998 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: $


Nested Class Summary
static class Serpent.Key
          Key implementation that is adapted to the Serpent 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
Serpent(sam.cipher.Key key)
           
 
Method Summary
protected  void decrypt(byte[] data, int offset, sam.cipher.Key key)
          Decrypt exactly one block of ciphertext.
protected  void encrypt(byte[] data, int offset, sam.cipher.Key key)
          Encrypt exactly one block of plaintext.
protected  int getPreferredSize(int size)
          Specifiy preferred buffer size.
 
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

Serpent

public Serpent(sam.cipher.Key key)
Method Detail

getPreferredSize

protected int getPreferredSize(int size)
Description copied from class: Cipher
Specifiy preferred buffer size.

May return a fixed value, ignoring suggested size (e.g. return 16;).

By default, this implementation simply returns its argument unchanged.

Overrides:
getPreferredSize in class Cipher
Parameters:
size - proposed buffer size (in bytes)
Returns:
adjusted buffer size (in bytes)

encrypt

protected void encrypt(byte[] data,
                       int offset,
                       sam.cipher.Key key)
Encrypt exactly one block of plaintext.

Specified by:
encrypt in class Cipher
Parameters:
data - The plaintext.

decrypt

protected void decrypt(byte[] data,
                       int offset,
                       sam.cipher.Key key)
Decrypt exactly one block of ciphertext.

Specified by:
decrypt in class Cipher
Parameters:
data - The ciphertext.