Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.jce.provider.cipher
Class RC6  view RC6 download RC6.java

java.lang.Object
  extended byjavax.crypto.CipherSpi
      extended bycryptix.jce.provider.cipher.BlockCipher
          extended bycryptix.jce.provider.cipher.RC6

public final class RC6
extends BlockCipher

Simple implementation of Ron Rivest's RC6 cipher. Use of this algorithm may be subject to licensing restrictions imposed by the RC6 inventor.

http://www.rsa.com/rsalabs/aes/

Version:
$Revision: 1.2 $

Field Summary
private static int BLOCK_SIZE
          Number of rounds
private  boolean decrypt
          Encrypt (false) or decrypt mode (true)
private static int P
          Magic constants
private static int Q
          Magic constants
private static int ROUNDS
          Number of rounds
private  int[] S
          Subkeys
 
Fields inherited from class cryptix.jce.provider.cipher.BlockCipher
 
Constructor Summary
RC6()
           
 
Method Summary
protected  void coreCrypt(byte[] in, int inOffset, byte[] out, int outOffset)
          Encrypt or decrypt a single block (16 bytes), depending on the current mode and key.
protected  void coreInit(java.security.Key key, boolean decrypt)
           
private  void generateSubKeys(byte[] key)
          Set encryption mode and key.
private static int rotl(int val, int amount)
          Rotate left.
private static int rotr(int val, int amount)
          Rotate right.
 
Methods inherited from class cryptix.jce.provider.cipher.BlockCipher
clone, coreGetBlockSize, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate
 
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineUnwrap, engineUpdate, engineWrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUNDS

private static final int ROUNDS
Number of rounds

See Also:
Constant Field Values

BLOCK_SIZE

private static final int BLOCK_SIZE
Number of rounds

See Also:
Constant Field Values

P

private static final int P
Magic constants

See Also:
Constant Field Values

Q

private static final int Q
Magic constants

See Also:
Constant Field Values

S

private int[] S
Subkeys


decrypt

private boolean decrypt
Encrypt (false) or decrypt mode (true)

Constructor Detail

RC6

public RC6()
Method Detail

coreInit

protected void coreInit(java.security.Key key,
                        boolean decrypt)
                 throws java.security.InvalidKeyException
Specified by:
coreInit in class BlockCipher

coreCrypt

protected final void coreCrypt(byte[] in,
                               int inOffset,
                               byte[] out,
                               int outOffset)
Encrypt or decrypt a single block (16 bytes), depending on the current mode and key. Input and output buffer may (partially) overlap. Expects valid parameters only.

Specified by:
coreCrypt in class BlockCipher

generateSubKeys

private final void generateSubKeys(byte[] key)
Set encryption mode and key. Expects valid parameters only.


rotl

private static int rotl(int val,
                        int amount)
Rotate left.


rotr

private static int rotr(int val,
                        int amount)
Rotate right.