org.bouncycastle.crypto.engines

Class CAST6Engine

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 intBLOCK_SIZE
protected static intROUNDS
protected int[]_Km
protected int[]_Kr
protected int[]_Tm
protected int[]_Tr
Constructor Summary
CAST6Engine()
Method Summary
protected voidCAST_Decipher(int A, int B, int C, int D, int[] result)
Does the 12 quad rounds rounds to decrypt the block.
protected voidCAST_Encipher(int A, int B, int C, int D, int[] result)
Does the 12 quad rounds rounds to encrypt the block.
protected intdecryptBlock(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 intencryptBlock(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.
StringgetAlgorithmName()
intgetBlockSize()
voidreset()
protected voidsetKey(byte[] key)

Field Detail

BLOCK_SIZE

protected static final int BLOCK_SIZE

ROUNDS

protected static final int ROUNDS

_Km

protected int[] _Km

_Kr

protected int[] _Kr

_Tm

protected int[] _Tm

_Tr

protected int[] _Tr

Constructor Detail

CAST6Engine

public CAST6Engine()

Method Detail

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

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

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.

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.

Parameters: src The plaintext buffer srcIndex An offset into src dst The ciphertext buffer dstIndex An offset into dst

getAlgorithmName

public String getAlgorithmName()

getBlockSize

public int getBlockSize()

reset

public void reset()

setKey

protected void setKey(byte[] key)