public class BlowfishECB extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCKSIZE
block size of this cipher (in bytes)
|
static int |
MAXKEYLENGTH
maximum possible key length in bytes
|
| Constructor and Description |
|---|
BlowfishECB(byte[] key)
The default constructor, using a simple binary key.
|
BlowfishECB(byte[] key,
int nOfs,
int nLen) |
| Modifier and Type | Method and Description |
|---|---|
static int |
byteArrayToInt(byte[] buf,
int nOfs) |
void |
cleanUp()
To clear data in the boxes before an instance is freed, the
actual value of this call can be argued, yet still nice to
have it.
|
int |
decrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
Decrypts a byte buffer to another buffer, extra misaligned data
will not be processed.
|
int |
encrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
Encrypts a byte buffer to another buffer, extra misaligned data
will not be processed.
|
protected int |
encryptPrv(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen) |
void |
initialize(byte[] key,
int nOfs,
int nLen)
Initializes the instances, but does not really reset it since the PBOXes are not reset.
|
void |
reset()
Reset the Encryptor/Decryptor using the last key used to initialize it.
|
void |
reset(byte[] key,
int nOfs,
int nlen)
Reset the Encryptor/Decryptor using a specific 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.
|
public static final int MAXKEYLENGTH
public static final int BLOCKSIZE
public BlowfishECB(byte[] key)
key - key material, up to MAXKEYLENGTH bytespublic BlowfishECB(byte[] key,
int nOfs,
int nLen)
BlowfishJ.BlowfishECB#initialize(byte[], int, int)public void reset()
public void reset(byte[] key,
int nOfs,
int nlen)
public static final int byteArrayToInt(byte[] buf,
int nOfs)
public void initialize(byte[] key,
int nOfs,
int nLen)
key - key material, up to MAXKEYLENGTH bytesnOfs - where to start readingnLen - number of bytespublic void cleanUp()
public boolean weakKeyCheck()
protected int encryptPrv(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
public int encrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with plaintext datanInPos - where to start reading the plaintext dataoutBuf - buffer to put the ciphertext datanOutPos - where to start writing the ciphertext datanLen - number of bytes to encryptpublic int decrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with ciphertext datanInPos - where to start reading the ciphertext dataoutBuf - buffer to put the plaintext datanOutPos - where to start writing the plaintext datanLen - number of bytes to decrypt