|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gregoire.util.crypto.BlowfishECB
implementation of the Blowfish encryption algorithm in ECB mode
Field Summary | |
static int |
BLOCKSIZE
block size of this cipher (in bytes) |
static int |
MAXKEYLENGTH
maximum possible key length |
Constructor Summary | |
BlowfishECB()
default constructor |
|
BlowfishECB(byte[] bfkey)
|
Method Summary | |
void |
cleanUp()
to clear data in the boxes before an instance is freed |
void |
decrypt(byte[] buffer)
decrypts a byte buffer (should be aligned to an 8 byte border) to itself |
void |
decrypt(byte[] inbuffer,
byte[] outbuffer)
decrypts a byte buffer (should be aligned to an 8 byte border) to another byte buffer (of the same size or bigger) |
void |
decrypt(int[] buffer)
decrypts an int buffer (should be aligned to an two integer border) |
void |
decrypt(int[] inbuffer,
int[] outbuffer)
decrypts an integer buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger) |
void |
decrypt(long[] buffer)
decrypts a long buffer to itself |
void |
decrypt(long[] inbuffer,
long[] outbuffer)
decrypts a long buffer to another long buffer (of the same size or bigger) |
protected long |
decryptBlock(long lCipherBlock)
|
void |
encrypt(byte[] buffer)
encrypts a byte buffer (should be aligned to an 8 byte border) to itself |
void |
encrypt(byte[] inbuffer,
byte[] outbuffer)
encrypts a byte buffer (should be aligned to an 8 byte border) to another buffer (of the same size or bigger) |
void |
encrypt(int[] buffer)
encrypts an int buffer (should be aligned to a two integer border) |
void |
encrypt(int[] inbuffer,
int[] outbuffer)
encrypts an integer buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger) |
void |
encrypt(long[] buffer)
encrypts a long buffer to itself |
void |
encrypt(long[] inbuffer,
long[] outbuffer)
encrypts a long buffer to another long buffer (of the same size or bigger) |
protected long |
encryptBlock(long lPlainBlock)
|
int |
getBlockSize()
Returns the block size, in bits, of the given block-cipher |
int |
getKeySize()
Returns the key size, in bits, of the given block-cipher |
void |
initialize(byte[] bfkey)
Initializes the cipher context with the given key. |
boolean |
weakKeyCheck()
to check if an instance actually was using a weak key, if so it might be better to use a different key or salt the existing one as alternative |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAXKEYLENGTH
public static final int BLOCKSIZE
Constructor Detail |
public BlowfishECB()
public BlowfishECB(byte[] bfkey)
Method Detail |
public void initialize(byte[] bfkey)
BlockCipher
initialize
in interface BlockCipher
bfkey
- key material, up to MAXKEYLENGTH bytespublic int getKeySize()
BlockCipher
getKeySize
in interface BlockCipher
public int getBlockSize()
BlockCipher
getBlockSize
in interface BlockCipher
public void cleanUp()
public boolean weakKeyCheck()
protected long encryptBlock(long lPlainBlock)
protected long decryptBlock(long lCipherBlock)
public void encrypt(byte[] inbuffer, byte[] outbuffer)
encrypt
in interface BlockCipher
inbuffer
- buffer with plaintext dataoutbuffer
- buffer to get the ciphertext datapublic void encrypt(byte[] buffer)
buffer
- buffer to encryptpublic void encrypt(int[] inbuffer, int[] outbuffer)
inbuffer
- buffer with plaintext datapublic void encrypt(int[] buffer)
buffer
- buffer to encryptpublic void encrypt(long[] inbuffer, long[] outbuffer)
inbuffer
- buffer with plaintext dataoutbuffer
- buffer to get the ciphertext datapublic void encrypt(long[] buffer)
buffer
- buffer to encryptpublic void decrypt(byte[] inbuffer, byte[] outbuffer)
decrypt
in interface BlockCipher
inbuffer
- buffer with ciphertext datapublic void decrypt(byte[] buffer)
buffer
- buffer to decryptpublic void decrypt(int[] inbuffer, int[] outbuffer)
inbuffer
- buffer with ciphertext dataoutbuffer
- buffer to get the plaintext datapublic void decrypt(int[] buffer)
buffer
- buffer to decryptpublic void decrypt(long[] inbuffer, long[] outbuffer)
inbuffer
- buffer with ciphertext dataoutbuffer
- buffer to get the plaintext datapublic void decrypt(long[] buffer)
buffer
- buffer to decrypt
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |