All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.security.Blowfish

java.lang.Object
   |
   +----cryptix.security.BlockCipher
           |
           +----cryptix.security.Blowfish

public class Blowfish
extends BlockCipher
Note: Blowfish is deprecated.

This class implements the Cryptix V2.2 API for the Blowfish block cipher. New code should use the JCA implementation of Blowfish, which can be obtained by calling Cipher.getInstance("Blowfish"), for example.

Blowfish was designed by Bruce Schneier. The algorithm is in the public domain.

This implementation throws a CryptoError if the user key length is out of range, or if any one of the two self-tests fail. The self-tests are as follows:

  1. encrypt 0 ten times using the initial S boxes and P values. Check the result against a known value. If equal decrypt the result 10 times and compare it to 0.
  2. complete the key expansion process and use the newly formed key to encrypt 10 times a block of all zeroes; decrypt the result 10 times and compare.

References:

  1. Bruce Schneier, "Section 14.3 Blowfish," Applied Cryptography, 2nd edition, John Wiley & Sons, 1996

  2. Bruce Schneier, "Description of a New Variable-Length Key, 64-Bit Cipher (Blowfish)," Fast Software Encryption Cambridge Security Workshop Proceedings, Springer-Verlag, 1004, pp 191-204.

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.6 $

Author:
Systemics Ltd, David Hopwood, Raif S. Naffah
See Also:
getInstance

Variable Index

 o BLOCK_LENGTH
The length of a block (8 bytes for Blowfish).
 o BLOCK_LENGTH_MAX
 o BLOCK_LENGTH_MIN
 o KEY_LENGTH
The default length of a user key (16 bytes for Blowfish).
 o KEY_LENGTH_MAX
 o KEY_LENGTH_MIN
 o KEY_LENGTH_MOD
 o NUM_ROUNDS
The 2.2 API only supports the default number of rounds, 16.

Constructor Index

 o Blowfish(byte[])
This creates a Blowfish block cipher instance, with key data taken from a byte array of a user-defined length.

Method Index

 o main(String[])
Entry point for very basic self_test.
 o self_test()
Do some basic tests.

Variables

 o BLOCK_LENGTH
 public static final int BLOCK_LENGTH
The length of a block (8 bytes for Blowfish).

 o BLOCK_LENGTH_MIN
 public static final int BLOCK_LENGTH_MIN
 o BLOCK_LENGTH_MAX
 public static final int BLOCK_LENGTH_MAX
 o KEY_LENGTH
 public static final int KEY_LENGTH
The default length of a user key (16 bytes for Blowfish).

 o KEY_LENGTH_MAX
 public static final int KEY_LENGTH_MAX
 o KEY_LENGTH_MIN
 public static final int KEY_LENGTH_MIN
 o KEY_LENGTH_MOD
 public static final int KEY_LENGTH_MOD
 o NUM_ROUNDS
 public static final int NUM_ROUNDS
The 2.2 API only supports the default number of rounds, 16.

Constructors

 o Blowfish
 public Blowfish(byte userKey[])
This creates a Blowfish block cipher instance, with key data taken from a byte array of a user-defined length.

Parameters:
userKey - the user key.
Throws: CryptoError
if an error occurs initialising the cipher.

Methods

 o main
 public static void main(String argv[])
Entry point for very basic self_test.

 o self_test
 public static void self_test() throws CryptoError
Do some basic tests. Three of the certification data are included only, no output, success or exception. If you want more, write a test program!

See Also:
TestBlowfish

All Packages  Class Hierarchy  This Package  Previous  Next  Index