Java Cryptography classes offer a variety of ways for you to encrypt and decrypt. One of them is using Blowfish. The methods below encrypt and decrypt Strings using a String key as its secret key.

In my previous post (Encrypt Using Blowflish And Java), I talked about a way to encrypt using Blowfish in Java. To decrypt it back to its original string, use this method below. Again, part of this method’s code uses a secondary method that converts hexadecimal to binary. You can find it here.

Blowfish is a symmetric block cipher that can be used as a drop-in replacement for DES or IDEA. It takes a variable-length key, from 32 bits to 448 bits, making it an ideal way for encryption purposes. Java supports Blowflish encryption in its API. Here is a method that will encrypt using Blowfish. Part of the code converts the string to be encrypted to byte[] array so this method uses a secondary method called convertBinary2Hexadecimal() which you can find here.

Related Posts Plugin for WordPress, Blogger...