BlowfishJ
Class BlowfishCBC

java.lang.Object
  |
  +--BlowfishJ.BlowfishECB
        |
        +--BlowfishJ.BlowfishCBC

public class BlowfishCBC
extends BlowfishECB

implementation of the Blowfish encryption algorithm in CBC mode

Version:
January 30, 2003
Author:
Markus Hahn

Fields inherited from class BlowfishJ.BlowfishECB
BLOCKSIZE, MAXKEYLENGTH
 
Constructor Summary
BlowfishCBC(byte[] key)
          Deprecated.  
BlowfishCBC(byte[] key, byte[] initCBCIV)
          Deprecated.  
BlowfishCBC(byte[] key, int nOfs, int nLen)
          Constructor, uses a zero CBC IV.
BlowfishCBC(byte[] key, int nOfs, int nLen, byte[] initCBCIV, int nIVOfs)
          Constructor to define the CBC IV.
BlowfishCBC(byte[] key, int nOfs, int nLen, long lInitCBCIV)
          Constructor to define the CBC IV.
BlowfishCBC(byte[] key, long lInitCBCIV)
          Deprecated.  
 
Method Summary
 void cleanUp()
          see BlowfishJ.BlowfishECB#cleanUp()
 void decrypt(byte[] buf)
          Decrypts a byte buffer (should be aligned) to itself.
 void decrypt(byte[] inBuf, byte[] outBuf)
          Decrypts a byte buffer (should be aligned to a block border) to another byte buffer (of the same size or bigger).
 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)
          Decrypts an integer buffer to itself.
 void decrypt(int[] inBuf, int[] outBuf)
          Decrypts an integer buffer (should be aligned to a two integer border) to another int buffer (of the same size or bigger).
 void decrypt(int[] inBuf, int nInPos, int[] outBuf, int nOutPos, int nLen)
          Decrypts an integer buffer to another integer buffer.
 void decrypt(long[] buf)
          Decrypts a long buffer to itself.
 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)
          Decrypts a long buffer to another long buffer (of the same size or bigger).
 void encrypt(byte[] buf)
          Encrypts a byte buffer (should be aligned to a block border) to itself.
 void encrypt(byte[] inBuf, byte[] outBuf)
          Encrypts a byte buffer (should be aligned to a block border) to another buffer (of the same size or bigger).
 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)
          Encrypts an integer buffer to itself.
 void encrypt(int[] inBuf, int[] outBuf)
          Encrypts an integer buffer (should be aligned to a two integer border) to another int buffer (of the same size or bigger).
 void encrypt(int[] inBuf, int nInPos, int[] outBuf, int nOutPos, int nLen)
          Encrypts an integer buffer to another integer buffer.
 void encrypt(long[] buf)
          Encrypts a long buffer to itself.
 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)
          Encrypts a long buffer to another long buffer (of the same size or bigger).
 long getCBCIV()
          Gets the current CBC IV.
 void getCBCIV(byte[] dest)
          Deprecated.  
 void getCBCIV(byte[] dest, int nOfs)
          Gets a copy of the current CBC IV.
 void setCBCIV(byte[] newCBCIV)
          Deprecated.  
 void setCBCIV(byte[] newCBCIV, int nOfs)
          Sets the current CBC IV (for cipher resets).
 void setCBCIV(long lNewCBCIV)
          Sets the current CBC IV (for cipher resets).
 
Methods inherited from class BlowfishJ.BlowfishECB
encryptPrv, selfTest, weakKeyCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlowfishCBC

public BlowfishCBC(byte[] key)
Deprecated.  

Default constructor, uses a zero CBC IV.
Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes

BlowfishCBC

public BlowfishCBC(byte[] key,
                   int nOfs,
                   int nLen)
Constructor, uses a zero CBC IV.
Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes
nOfs - where to start reading the key
nLen - size of the key in bytes

BlowfishCBC

public BlowfishCBC(byte[] key,
                   long lInitCBCIV)
Deprecated.  

Constructor to define the CBC IV.
Parameters:
key - key material, up to MAXKEYLENGTH bytes
lInitCBCIV - the CBC IV

BlowfishCBC

public BlowfishCBC(byte[] key,
                   int nOfs,
                   int nLen,
                   long lInitCBCIV)
Constructor to define the CBC IV.
Parameters:
key - key material, up to MAXKEYLENGTH bytes
nOfs - where to start reading the key
nLen - size of the key in bytes
lInitCBCIV - the CBC IV

BlowfishCBC

public BlowfishCBC(byte[] key,
                   byte[] initCBCIV)
Deprecated.  

Constructor to define the CBC IV.
Parameters:
key - key material, up to MAXKEYLENGTH bytes
initCBCIV - the CBC IV (array with BLOCKSIZE bytes)

BlowfishCBC

public BlowfishCBC(byte[] key,
                   int nOfs,
                   int nLen,
                   byte[] initCBCIV,
                   int nIVOfs)
Constructor to define the CBC IV.
Parameters:
key - key material, up to MAXKEYLENGTH bytes
nOfs - where to start reading the key
nLen - size of the key in bytes
initCBCIV - the CBC IV
nIVOfs - where to start reading the IV
Method Detail

getCBCIV

public long getCBCIV()
Gets the current CBC IV.
Returns:
current CBC IV

getCBCIV

public void getCBCIV(byte[] dest)
Deprecated.  

Gets a copy of the current CBC IV.
Parameters:
dest - where to put current CBC IV

getCBCIV

public void getCBCIV(byte[] dest,
                     int nOfs)
Gets a copy of the current CBC IV.
Parameters:
dest - buffer
nOfs - where to start writing

setCBCIV

public void setCBCIV(long lNewCBCIV)
Sets the current CBC IV (for cipher resets).
Parameters:
lNewCBCIV - the new CBC IV

setCBCIV

public void setCBCIV(byte[] newCBCIV)
Deprecated.  

Sets the current CBC IV (for cipher resets).
Parameters:
newCBCIV - the new CBC IV

setCBCIV

public void setCBCIV(byte[] newCBCIV,
                     int nOfs)
Sets the current CBC IV (for cipher resets).
Parameters:
newCBCIV - the new CBC IV
nOfs - where to start reading the IV

cleanUp

public void cleanUp()
see BlowfishJ.BlowfishECB#cleanUp()
Overrides:
cleanUp in class BlowfishECB

encrypt

public int encrypt(byte[] inBuf,
                   int nInPos,
                   byte[] outBuf,
                   int nOutPos,
                   int nLen)
Description copied from class: BlowfishECB
Encrypts a byte buffer to another buffer, extra misaligned data will not be processed.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(byte[], int, byte[], int, int)

encrypt

public void encrypt(byte[] inBuf,
                    byte[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts a byte buffer (should be aligned to a block border) to another buffer (of the same size or bigger).
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(byte[], byte[])

encrypt

public void encrypt(byte[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts a byte buffer (should be aligned to a block border) to itself.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(byte[])

encrypt

public void encrypt(int[] inBuf,
                    int nInPos,
                    int[] outBuf,
                    int nOutPos,
                    int nLen)
Description copied from class: BlowfishECB
Encrypts an integer buffer to another integer buffer.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(int[], int, int[], int, int)

encrypt

public void encrypt(int[] inBuf,
                    int[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts an integer buffer (should be aligned to a two integer border) to another int buffer (of the same size or bigger).
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(int[], int[])

encrypt

public void encrypt(int[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts an integer buffer to itself.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(int[])

encrypt

public void encrypt(long[] inBuf,
                    int nInPos,
                    long[] outBuf,
                    int nOutPos,
                    int nLen)
Description copied from class: BlowfishECB
Encrypts an long buffer to another long buffer.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(long[], int, long[], int, int)

encrypt

public void encrypt(long[] inBuf,
                    long[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts a long buffer to another long buffer (of the same size or bigger).
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(long[], long[])

encrypt

public void encrypt(long[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Encrypts a long buffer to itself.
Overrides:
encrypt in class BlowfishECB
See Also:
BlowfishECB.encrypt(long[])

decrypt

public int decrypt(byte[] inBuf,
                   int nInPos,
                   byte[] outBuf,
                   int nOutPos,
                   int nLen)
Description copied from class: BlowfishECB
Decrypts a byte buffer to another buffer, extra misaligned data will not be processed.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(byte[], int, byte[], int, int)

decrypt

public void decrypt(byte[] inBuf,
                    byte[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts a byte buffer (should be aligned to a block border) to another byte buffer (of the same size or bigger).
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(byte[], byte[])

decrypt

public void decrypt(byte[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts a byte buffer (should be aligned) to itself.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(byte[])

decrypt

public void decrypt(int[] inBuf,
                    int nInPos,
                    int[] outBuf,
                    int nOutPos,
                    int nLen)
Description copied from class: BlowfishECB
Decrypts an integer buffer to another integer buffer.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(int[], int, int[], int, int)

decrypt

public void decrypt(int[] inBuf,
                    int[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts an integer buffer (should be aligned to a two integer border) to another int buffer (of the same size or bigger).
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(int[], int[])

decrypt

public void decrypt(int[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts an integer buffer to itself.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(int[])

decrypt

public void decrypt(long[] inBuf,
                    int nInPos,
                    long[] outBuf,
                    int nOutPos,
                    int nLen)
Description copied from class: BlowfishECB
Decrypts an long buffer to another long buffer.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(long[], int, long[], int, int)

decrypt

public void decrypt(long[] inBuf,
                    long[] outBuf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts a long buffer to another long buffer (of the same size or bigger).
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(long[], long[])

decrypt

public void decrypt(long[] buf)
Deprecated.  

Description copied from class: BlowfishECB
Decrypts a long buffer to itself.
Overrides:
decrypt in class BlowfishECB
See Also:
BlowfishECB.decrypt(long[])