superwaba.ext.xplat.util.crypto
Class BlowfishECB

java.lang.Object
  |
  +--superwaba.ext.xplat.util.crypto.BlowfishECB
Direct Known Subclasses:
BlowfishCBC

public class BlowfishECB
extends Object

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(byte[] bfkey)
          default constructor
 
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)
           
static boolean selfTest()
          selftest routine, to check e.g. for a valid class file transmission
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Field Detail

MAXKEYLENGTH

public static final int MAXKEYLENGTH
maximum possible key length

BLOCKSIZE

public static final int BLOCKSIZE
block size of this cipher (in bytes)
Constructor Detail

BlowfishECB

public BlowfishECB(byte[] bfkey)
default constructor
Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes
Method Detail

cleanUp

public void cleanUp()
to clear data in the boxes before an instance is freed

selfTest

public static boolean selfTest()
selftest routine, to check e.g. for a valid class file transmission
Returns:
true: selftest passed / false: selftest failed

encryptBlock

protected long encryptBlock(long lPlainBlock)

decryptBlock

protected long decryptBlock(long lCipherBlock)

encrypt

public 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)
Parameters:
inbuffer - buffer with plaintext data
outbuffer - buffer to get the ciphertext data

encrypt

public void encrypt(byte[] buffer)
encrypts a byte buffer (should be aligned to an 8 byte border) to itself
Parameters:
buffer - buffer to encrypt

encrypt

public 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)
Parameters:
inbuffer - buffer with plaintext data
outBuffer - buffer to get the ciphertext data

encrypt

public void encrypt(int[] buffer)
encrypts an int buffer (should be aligned to a two integer border)
Parameters:
buffer - buffer to encrypt

encrypt

public void encrypt(long[] inbuffer,
                    long[] outbuffer)
encrypts a long buffer to another long buffer (of the same size or bigger)
Parameters:
inbuffer - buffer with plaintext data
outbuffer - buffer to get the ciphertext data

encrypt

public void encrypt(long[] buffer)
encrypts a long buffer to itself
Parameters:
buffer - buffer to encrypt

decrypt

public 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)
Parameters:
inbuffer - buffer with ciphertext data
outBuffer - buffer to get the plaintext data

decrypt

public void decrypt(byte[] buffer)
decrypts a byte buffer (should be aligned to an 8 byte border) to itself
Parameters:
buffer - buffer to decrypt

decrypt

public 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)
Parameters:
inbuffer - buffer with ciphertext data
outbuffer - buffer to get the plaintext data

decrypt

public void decrypt(int[] buffer)
decrypts an int buffer (should be aligned to an two integer border)
Parameters:
buffer - buffer to decrypt

decrypt

public void decrypt(long[] inbuffer,
                    long[] outbuffer)
decrypts a long buffer to another long buffer (of the same size or bigger)
Parameters:
inbuffer - buffer with ciphertext data
outbuffer - buffer to get the plaintext data

decrypt

public void decrypt(long[] buffer)
decrypts a long buffer to itself
Parameters:
buffer - buffer to decrypt