sam.cipher
Class RC6

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

public class RC6
extends Cipher

Implementation of the RC6 cipher. Retrofitted for personal use by Guillaume Lacôte. This program is part of an implementation of the block cipher RC6(TM) that is being submitted to NIST as a candidate for the AES. Ronald L. Rivest and RSA Laboratories, the submitters of RC6, retain all rights to RC6 and to this code, except for those which NIST requires to be waived for submissions. Copyright (C) 1998 RSA Data Security, Inc. Parts Copyright (c) 1997, 1998 Systemics Ltd on behalf of the Cryptix Development Team. All rights reserved. Portions of this code are Copyright © 1997, 1998 Systemics Ltd on behalf of the Cryptix DevelopmentTeam.
All rights reserved.

$Revision: $


Nested Class Summary
static class RC6.Key
          Key implementation that is adapted to the RC6 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
RC6(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.
 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

RC6

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

getPreferredSize

public 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:
The length in bytes of the Algorithm input block.

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.
key - The session key to use for encryption.

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.
key - The session key to use for decryption.