org.bouncycastle.crypto.engines

## Class CAST6Engine

- java.lang.Object
- - org.bouncycastle.crypto.engines.CAST5Engine
  - - org.bouncycastle.crypto.engines.CAST6Engine

All Implemented Interfaces:
  BlockCipher

    public final class CAST6Engine
    extends CAST5Engine

A class that provides CAST6 key encryption operations, such as encoding data and generating keys. All the algorithms herein are from the Internet RFC RFC2612 - CAST6 (128bit block, 128-256bit key) and implement a simplified cryptography interface.

### Field Summary

Fields
`protected int[]` `_Km`
`protected int[]` `_Kr`
`protected int[]` `_Tm`
`protected int[]` `_Tr`
`protected static int` `BLOCK_SIZE`
`protected static int` `ROUNDS`

### Fields inherited from class org.bouncycastle.crypto.engines.CAST5Engine

`M32, MAX_ROUNDS, RED_ROUNDS, S1, S2, S3, S4, S5, S6, S7, S8`

### Constructor Summary

Constructors
Constructor and Description
`CAST6Engine()`

### Method Summary

Methods
`protected void` `CAST_Decipher(int A, int B, int C, int D, int[] result)` Does the 12 quad rounds rounds to decrypt the block.
`protected void` `CAST_Encipher(int A, int B, int C, int D, int[] result)` Does the 12 quad rounds rounds to encrypt the block.
`protected int` `decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)` Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.
`protected int` `encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)` Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.
`java.lang.String` `getAlgorithmName()` Return the name of the algorithm the cipher implements.
`int` `getBlockSize()` Return the block size for this cipher (in bytes).
`void` `reset()` Reset the cipher.
`protected void` `setKey(byte[] key)`

### Methods inherited from class org.bouncycastle.crypto.engines.CAST5Engine

`Bits32ToBytes, Bits32ToInts, BytesTo32bits, CAST_Decipher, CAST_Encipher, F1, F2, F3, init, IntsTo32bits, processBlock`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ROUNDS

    protected static final int ROUNDS

See Also:
  Constant Field Values

#### BLOCK_SIZE

    protected static final int BLOCK_SIZE

See Also:
  Constant Field Values

#### _Kr

    protected int[] _Kr

#### _Km

    protected int[] _Km

#### _Tr

    protected int[] _Tr

#### _Tm

    protected int[] _Tm

### Constructor Detail

#### CAST6Engine

    public CAST6Engine()

### Method Detail

#### getAlgorithmName

    public java.lang.String getAlgorithmName()

Description copied from interface: `BlockCipher`
Return the name of the algorithm the cipher implements.

Specified by:
  `getAlgorithmName` in interface `BlockCipher`
Overrides:
  `getAlgorithmName` in class `CAST5Engine`
Returns:
  the name of the algorithm the cipher implements.

#### reset

    public void reset()

Description copied from interface: `BlockCipher`
Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).

Specified by:
  `reset` in interface `BlockCipher`
Overrides:
  `reset` in class `CAST5Engine`

#### getBlockSize

    public int getBlockSize()

Description copied from interface: `BlockCipher`
Return the block size for this cipher (in bytes).

Specified by:
  `getBlockSize` in interface `BlockCipher`
Overrides:
  `getBlockSize` in class `CAST5Engine`
Returns:
  the block size for this cipher in bytes.

#### setKey

    protected void setKey(byte[] key)

Overrides:
  `setKey` in class `CAST5Engine`

#### encryptBlock

    protected int encryptBlock(byte[] src,
                   int srcIndex,
                   byte[] dst,
                   int dstIndex)

Encrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.

Overrides:
  `encryptBlock` in class `CAST5Engine`
Parameters:
  `src` - The plaintext buffer
  `srcIndex` - An offset into src
  `dst` - The ciphertext buffer
  `dstIndex` - An offset into dst

#### decryptBlock

    protected int decryptBlock(byte[] src,
                   int srcIndex,
                   byte[] dst,
                   int dstIndex)

Decrypt the given input starting at the given offset and place the result in the provided buffer starting at the given offset.

Overrides:
  `decryptBlock` in class `CAST5Engine`
Parameters:
  `src` - The plaintext buffer
  `srcIndex` - An offset into src
  `dst` - The ciphertext buffer
  `dstIndex` - An offset into dst

#### CAST_Encipher

    protected final void CAST_Encipher(int A,
                     int B,
                     int C,
                     int D,
                     int[] result)

Does the 12 quad rounds rounds to encrypt the block.

Parameters:
  `A` - the 00-31 bits of the plaintext block
  `B` - the 32-63 bits of the plaintext block
  `C` - the 64-95 bits of the plaintext block
  `D` - the 96-127 bits of the plaintext block
  `result` - the resulting ciphertext

#### CAST_Decipher

    protected final void CAST_Decipher(int A,
                     int B,
                     int C,
                     int D,
                     int[] result)

Does the 12 quad rounds rounds to decrypt the block.

Parameters:
  `A` - the 00-31 bits of the ciphertext block
  `B` - the 32-63 bits of the ciphertext block
  `C` - the 64-95 bits of the ciphertext block
  `D` - the 96-127 bits of the ciphertext block
  `result` - the resulting plaintext