net.sourceforge.blowfishj
Class BlowfishCBC

java.lang.Object
  extended bynet.sourceforge.blowfishj.BlowfishECB
      extended bynet.sourceforge.blowfishj.BlowfishCBC

public class BlowfishCBC
extends BlowfishECB

Implementation of the Blowfish encryption algorithm in CBC mode.


Field Summary
 
Fields inherited from class net.sourceforge.blowfishj.BlowfishECB
BLOCKSIZE, MAXKEYLENGTH
 
Constructor Summary
BlowfishCBC(byte[] key)
          Deprecated. use BlowfishCBC(byte[], int, int) instead
BlowfishCBC(byte[] key, byte[] initCBCIV)
          Deprecated. use BlowfishCBC(byte[], int, int, byte[], int) instead
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. use BlowfishCBC(byte[], int, int, long) instead
 
Method Summary
 void cleanUp()
          see net.sourceforge.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. use getCBCIV(byte[], int) instead
 void getCBCIV(byte[] dest, int nOfs)
          Gets a copy of the current CBC IV.
 void setCBCIV(byte[] newCBCIV)
          Deprecated. use setCBCIV(byte[], int) instead
 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 net.sourceforge.blowfishj.BlowfishECB
encryptPrv, initialize, 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. use BlowfishCBC(byte[], int, int) instead

Default constructor, uses a zero CBC IV.

Parameters:
key - key material, up to MAXKEYLENGTH bytes

BlowfishCBC

public BlowfishCBC(byte[] key,
                   int nOfs,
                   int nLen)
Constructor, uses a zero CBC IV.

Parameters:
key - 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. use BlowfishCBC(byte[], int, int, long) instead

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. use BlowfishCBC(byte[], int, int, byte[], int) instead

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. use getCBCIV(byte[], int) instead

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. use setCBCIV(byte[], int) instead

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 net.sourceforge.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
Parameters:
inBuf - buffer with plaintext data
nInPos - where to start reading the plaintext data
outBuf - buffer to put the ciphertext data
nOutPos - where to start writing the ciphertext data
nLen - number of bytes to encrypt
Returns:
number of bytes to encrypted
See Also:
BlowfishECB.encrypt(byte[], int, byte[], int, int)

encrypt

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

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
Parameters:
inBuf - buffer with plaintext data
outBuf - buffer to get the ciphertext data
See Also:
BlowfishECB.encrypt(byte[], byte[])

encrypt

public void encrypt(byte[] buf)
Deprecated. use encrypt(byte[], int, int) instead

Description copied from class: BlowfishECB
Encrypts a byte buffer (should be aligned to a block border) to itself.

Overrides:
encrypt in class BlowfishECB
Parameters:
buf - buffer to encrypt
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
Parameters:
inBuf - buffer with plaintext data
nInPos - where to start reading the plaintext data
outBuf - buffer to write the ciphertext data
nOutPos - where to start writing the ciphertext data
nLen - number of integers to encrypt
See Also:
BlowfishECB.encrypt(int[], int, int[], int, int)

encrypt

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

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
Parameters:
inBuf - buffer with ciphertext data
outBuf - buffer to get the plaintext data
See Also:
BlowfishECB.encrypt(int[], int[])

encrypt

public void encrypt(int[] buf)
Deprecated. use encrypt(int[], int, int[], int, int) instead

Description copied from class: BlowfishECB
Encrypts an integer buffer to itself.

Overrides:
encrypt in class BlowfishECB
Parameters:
buf - buffer to decrypt
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
Parameters:
inBuf - buffer with plaintext data
nInPos - where to start reading the plaintext data
outBuf - buffer to write the ciphertext data
nOutPos - where to start writing the ciphertext data
nLen - number of longs to decrypt
See Also:
BlowfishECB.encrypt(long[], int, long[], int, int)

encrypt

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

Description copied from class: BlowfishECB
Encrypts a long buffer to another long buffer (of the same size or bigger).

Overrides:
encrypt in class BlowfishECB
Parameters:
inBuf - buffer with ciphertext data
outBuf - buffer to get the plaintext data
See Also:
BlowfishECB.encrypt(long[], long[])

encrypt

public void encrypt(long[] buf)
Deprecated. use encrypt(long[], int, long[], int, int) instead

Description copied from class: BlowfishECB
Encrypts a long buffer to itself.

Overrides:
encrypt in class BlowfishECB
Parameters:
buf - buffer to decrypt
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
Parameters:
inBuf - buffer with ciphertext data
nInPos - where to start reading the ciphertext data
outBuf - buffer to put the plaintext data
nOutPos - where to start writing the plaintext data
nLen - number of bytes to decrypt
Returns:
number of bytes to encrypted
See Also:
BlowfishECB.decrypt(byte[], int, byte[], int, int)

decrypt

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

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
Parameters:
inBuf - buffer with ciphertext data
outBuf - buffer to get the plaintext data
See Also:
BlowfishECB.decrypt(byte[], byte[])

decrypt

public void decrypt(byte[] buf)
Deprecated. use encrypt(byte[], int, byte[], int, int) instead

Description copied from class: BlowfishECB
Decrypts a byte buffer (should be aligned) to itself.

Overrides:
decrypt in class BlowfishECB
Parameters:
buf - buffer to decrypt
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
Parameters:
inBuf - buffer with ciphertext data
nInPos - where to start reading the ciphertext data
outBuf - buffer to get the plaintext data
nOutPos - where to start writing the plaintext data
nLen - number of integers to decrypt
See Also:
BlowfishECB.decrypt(int[], int, int[], int, int)

decrypt

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

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
Parameters:
inBuf - buffer with ciphertext data
outBuf - buffer to get the plaintext data
See Also:
BlowfishECB.decrypt(int[], int[])

decrypt

public void decrypt(int[] buf)
Deprecated. use decrypt(int[], int, int[], int, int) instead

Description copied from class: BlowfishECB
Decrypts an integer buffer to itself.

Overrides:
decrypt in class BlowfishECB
Parameters:
buf - buffer to decrypt
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
Parameters:
inBuf - buffer with ciphertext data
nInPos - where to start reading the ciphertext data
outBuf - buffer to write the plaintext data
nOutPos - where to start writing the plaintext data
nLen - number of longs to decrypt
See Also:
BlowfishECB.decrypt(long[], int, long[], int, int)

decrypt

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

Description copied from class: BlowfishECB
Decrypts a long buffer to another long buffer (of the same size or bigger).

Overrides:
decrypt in class BlowfishECB
Parameters:
inBuf - buffer with ciphertext data
outBuf - buffer to get the plaintext data
See Also:
BlowfishECB.decrypt(long[], long[])

decrypt

public void decrypt(long[] buf)
Deprecated. use decrypt(long[], int, long[], int, int) instead

Description copied from class: BlowfishECB
Decrypts a long buffer to itself.

Overrides:
decrypt in class BlowfishECB
Parameters:
buf - buffer to decrypt
See Also:
BlowfishECB.decrypt(long[])


Copyright © 2004-2005 Sourceforge. All Rights Reserved.