Blowfish for Java 1.5 Demonstration

This is a small example how the Blowfish classes might be used.

One of the following browsers are required to use the applet flawlessly:

Just enter a password and some plaintext and watch (after a click on the [Encrypt] button) how the data is going to be encrypted. Click [Decrypt] to see your original message again.

The data representation of the encrypted data is in binhex format. For that you must remember that data is always aligned to 8 byte blocks to be used with Blowfish and the Java characters need 2 bytes to be stored, because of the Unicode format. So even one single character will be stretched to 4 characters (padding bytes will also be appended) for building one 8 byte block. In the binhex representation every 16bit character will be converted to a 4 byte hex pattern, e.g. a blank ' ' (ASCII code 32) equals 0020.

Even a blank message will produce an output. This is caused by the padding scheme and the initialisation vector (at least 16 bytes together). Due to the CBC mode every encrypted message is unqiue, even when the original text was the same. Empty passwords are also accepted - the setup via the SHA-1 stage allows it, although there will be no security at all then.
 

Download the complete Blowfish package right here.

Copyright (C) 1998 Markus Hahn.
All rights reserved.