public class BlowfishECB
extends java.lang.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()
The default constructor, call initialize() afterwards to do the final
setup.
|
BlowfishECB(byte[] key)
Deprecated.
use BlowfishECB(byte[], int, int) instead
|
BlowfishECB(byte[] key,
int nOfs,
int nLen) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
decrypt(byte[] buf)
Deprecated.
use decrypt(byte[], int, byte[], int, int) instead
|
void |
decrypt(byte[] inBuf,
byte[] outBuf)
Deprecated.
use decrypt(byte[], int, byte[], int, int) instead
|
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.
|
void |
decrypt(int[] buf)
Deprecated.
use decrypt(int[], int, int[], int, int) instead
|
void |
decrypt(int[] inBuf,
int[] outBuf)
Deprecated.
use decrypt(int[], int, int[], int, int) instead
|
void |
decrypt(int[] inBuf,
int nInPos,
int[] outBuf,
int nOutPos,
int nLen)
Decrypts an integer buffer to another integer buffer.
|
void |
decrypt(long[] buf)
Deprecated.
use decrypt(long[], int, long[], int, int) instead
|
void |
decrypt(long[] inBuf,
int nInPos,
long[] outBuf,
int nOutPos,
int nLen)
Decrypts an long buffer to another long buffer.
|
void |
decrypt(long[] inBuf,
long[] outBuf)
Deprecated.
use decrypt(long[], int, long[], int, int) instead
|
void |
encrypt(byte[] buf)
Deprecated.
use encrypt(byte[], int, byte[], int, int) instead
|
void |
encrypt(byte[] inBuf,
byte[] outBuf)
Deprecated.
use encrypt(byte[], int, byte[], int, int) instead
|
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.
|
void |
encrypt(int[] buf)
Deprecated.
use encrypt(int[], int, int[], int, int) instead
|
void |
encrypt(int[] inBuf,
int[] outBuf)
Deprecated.
use encrypt(int[], int, int[], int, int) instead
|
void |
encrypt(int[] inBuf,
int nInPos,
int[] outBuf,
int nOutPos,
int nLen)
Encrypts an integer buffer to another integer buffer.
|
void |
encrypt(long[] buf)
Deprecated.
use encrypt(long[], int, long[], int, int) instead
|
void |
encrypt(long[] inBuf,
int nInPos,
long[] outBuf,
int nOutPos,
int nLen)
Encrypts an long buffer to another long buffer.
|
void |
encrypt(long[] inBuf,
long[] outBuf)
Deprecated.
use encrypt(long[], int, long[], int, int) instead
|
protected int |
encryptPrv(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen) |
void |
initialize(byte[] key,
int nOfs,
int nLen)
Initializes (or resets) the instances.
|
static boolean |
selfTest()
Selftest routine, for instance to check for a valid class file loading.
|
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()
public BlowfishECB(byte[] key)
key - key material, up to MAXKEYLENGTH bytespublic BlowfishECB(byte[] key,
int nOfs,
int nLen)
initialize(byte[], int, int)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 static boolean selfTest()
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 void encrypt(byte[] inBuf,
byte[] outBuf)
inBuf - buffer with plaintext dataoutBuf - buffer to get the ciphertext datapublic void encrypt(byte[] buf)
buf - buffer to encryptpublic void encrypt(int[] inBuf,
int nInPos,
int[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with plaintext datanInPos - where to start reading the plaintext dataoutBuf - buffer to write the ciphertext datanOutPos - where to start writing the ciphertext datanLen - number of integers to encryptpublic void encrypt(int[] inBuf,
int[] outBuf)
inBuf - buffer with ciphertext dataoutBuf - buffer to get the plaintext datapublic void encrypt(int[] buf)
buf - buffer to decryptpublic void encrypt(long[] inBuf,
int nInPos,
long[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with plaintext datanInPos - where to start reading the plaintext dataoutBuf - buffer to write the ciphertext datanOutPos - where to start writing the ciphertext datanLen - number of longs to decryptpublic void encrypt(long[] inBuf,
long[] outBuf)
inBuf - buffer with ciphertext dataoutBuf - buffer to get the plaintext datapublic void encrypt(long[] buf)
buf - buffer to decryptpublic 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 decryptpublic void decrypt(byte[] inBuf,
byte[] outBuf)
inBuf - buffer with ciphertext dataoutBuf - buffer to get the plaintext datapublic void decrypt(byte[] buf)
buf - buffer to decryptpublic void decrypt(int[] inBuf,
int nInPos,
int[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with ciphertext datanInPos - where to start reading the ciphertext dataoutBuf - buffer to get the plaintext datanOutPos - where to start writing the plaintext datanLen - number of integers to decryptpublic void decrypt(int[] inBuf,
int[] outBuf)
inBuf - buffer with ciphertext dataoutBuf - buffer to get the plaintext datapublic void decrypt(int[] buf)
buf - buffer to decryptpublic void decrypt(long[] inBuf,
int nInPos,
long[] outBuf,
int nOutPos,
int nLen)
inBuf - buffer with ciphertext datanInPos - where to start reading the ciphertext dataoutBuf - buffer to write the plaintext datanOutPos - where to start writing the plaintext datanLen - number of longs to decryptpublic void decrypt(long[] inBuf,
long[] outBuf)
inBuf - buffer with ciphertext dataoutBuf - buffer to get the plaintext datapublic void decrypt(long[] buf)
buf - buffer to decrypt