|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bouncycastle.crypto.engines.BlowfishEngine
public final class BlowfishEngine
A class that provides Blowfish key encryption operations, such as encoding data and generating keys. All the algorithms herein are from Applied Cryptography and implement a simplified cryptography interface.
Field Summary | |
---|---|
private static int |
BLOCK_SIZE
|
private boolean |
encrypting
|
private static int[] |
KP
|
private static int[] |
KS0
|
private static int[] |
KS1
|
private static int[] |
KS2
|
private static int[] |
KS3
|
private int[] |
P
|
private static int |
P_SZ
|
private static int |
ROUNDS
|
private int[] |
S0
|
private int[] |
S1
|
private int[] |
S2
|
private int[] |
S3
|
private static int |
SBOX_SK
|
private byte[] |
workingKey
|
Constructor Summary | |
---|---|
BlowfishEngine()
|
Method Summary | |
---|---|
private void |
Bits32ToBytes(int in,
byte[] b,
int offset)
|
private int |
BytesTo32bits(byte[] b,
int i)
|
private void |
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. |
private void |
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. |
private int |
F(int x)
|
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 |
init(boolean encrypting,
CipherParameters params)
initialise a Blowfish cipher. |
int |
processBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Process one block of input from the array in and write it to the out array. |
private void |
processTable(int xl,
int xr,
int[] table)
apply the encryption cycle to each value pair in the table. |
void |
reset()
Reset the cipher. |
private void |
setKey(byte[] key)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int[] KP
private static final int[] KS0
private static final int[] KS1
private static final int[] KS2
private static final int[] KS3
private static final int ROUNDS
private static final int BLOCK_SIZE
private static final int SBOX_SK
private static final int P_SZ
private final int[] S0
private final int[] S1
private final int[] S2
private final int[] S3
private final int[] P
private boolean encrypting
private byte[] workingKey
Constructor Detail |
---|
public BlowfishEngine()
Method Detail |
---|
public void init(boolean encrypting, CipherParameters params)
init
in interface BlockCipher
encrypting
- whether or not we are for encryption.params
- the parameters required to set up the cipher.
java.lang.IllegalArgumentException
- if the params argument is
inappropriate.public java.lang.String getAlgorithmName()
BlockCipher
getAlgorithmName
in interface BlockCipher
public final int processBlock(byte[] in, int inOff, byte[] out, int outOff)
BlockCipher
processBlock
in interface BlockCipher
in
- the array containing the input data.inOff
- offset into the in array the data starts at.out
- the array the output data will be copied into.outOff
- the offset into the out array the output will start at.
public void reset()
BlockCipher
reset
in interface BlockCipher
public int getBlockSize()
BlockCipher
getBlockSize
in interface BlockCipher
private int F(int x)
private void processTable(int xl, int xr, int[] table)
private void setKey(byte[] key)
private void encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
private void decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
private int BytesTo32bits(byte[] b, int i)
private void Bits32ToBytes(int in, byte[] b, int offset)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |