org.bouncycastle.crypto.engines

Class CAST6Engine

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

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

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

BLOCK_SIZE, M32, MAX_ROUNDS, RED_ROUNDS, S1, S2, S3, S4, S5, S6, S7, S8, _Km, _Kr

Constructor Summary

CAST6Engine()

Method Summary

protected void
CAST_Decipher(int A, int B, int C, int D, result[] )
Does the 12 quad rounds rounds to decrypt the block.
protected void
CAST_Encipher(int A, int B, int C, int D, 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.
String
getAlgorithmName()
int
getBlockSize()
void
reset()
protected void
setKey(byte[] key)

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

Bits32ToBytes, Bits32ToInts, BytesTo32bits, CAST_Decipher, CAST_Encipher, F1, F2, F3, IntsTo32bits, decryptBlock, encryptBlock, getAlgorithmName, getBlockSize, init, processBlock, reset, setKey

Field Details

BLOCK_SIZE

protected static final int BLOCK_SIZE
Field Value:
16

ROUNDS

protected static final int ROUNDS
Field Value:
12

_Km

protected int[] _Km

_Kr

protected int[] _Kr

_Tm

protected int[] _Tm

_Tr

protected int[] _Tr

Constructor Details

CAST6Engine

public CAST6Engine()

Method Details

CAST_Decipher

protected final void CAST_Decipher(int A,
                                   int B,
                                   int C,
                                   int D,
                                   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

CAST_Encipher

protected final void CAST_Encipher(int A,
                                   int B,
                                   int C,
                                   int D,
                                   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

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 interface CAST5Engine
Parameters:
src - The plaintext buffer
srcIndex - An offset into src
dst - The ciphertext buffer
dstIndex - An offset into dst

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 interface CAST5Engine
Parameters:
src - The plaintext buffer
srcIndex - An offset into src
dst - The ciphertext buffer
dstIndex - An offset into dst

getAlgorithmName

public String getAlgorithmName()
Specified by:
getAlgorithmName in interface BlockCipher
Overrides:
getAlgorithmName in interface CAST5Engine

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface BlockCipher
Overrides:
getBlockSize in interface CAST5Engine

reset

public void reset()
Specified by:
reset in interface BlockCipher
Overrides:
reset in interface CAST5Engine

setKey

protected void setKey(byte[] key)
Overrides:
setKey in interface CAST5Engine