As Wiki says,Blowfish is a
>> Keyed ( Key is the parameter that is used to determine the output of a cryptographic algorithm or cipher ),
>> Symmetric ( The same key is used for both encryption and decryption ),
>> Block cipher (operates on fixed-length groups of bits,),
designed in 1993 by Bruce Schneier. You can find more details from Wiki , so I do not repeat Key Encryption, Encryption, and Decryption details.
I have found two java implementations of Blowfish,
1.Java 2 Platform SE v1.4.2, javax.crypto package
2.GNU blowfish implementation
I have developed a sample application that you can simply start with using 1st implementation. This can be used to encrypt a string using a key (length <=128). The BlowfishEncryptor class API is as follows
/**
* Generates a secret key for a given key size and store in a file. This is
* used only once.
* @param keySize
* Size of the key
* @param fileName
* File name that needs to be stored
*/
public void generateKey(int keySize, String fileName)
/**
* Takes a single String as an argument and returns an Encrypted version of
* that String.
* @param str
* String to be encrypted
* @return
String Encrypted version of the provided String*/
public String encrypt(String str)
/**
* Initializing this object's encrypter and decrypter
* Chipher instances given a secret key file name.
* @param keyFileName
* Secret Key used to identify the key file
*/
public void init(String keyFileName)
/**
* Takes a encrypted String as an argument, decrypts and returns the
* decrypted String.
* @param str
* Encrypted String to be decrypted
* @return
String Decrypted version of the provided String*/
public String decrypt(String str)
The eclipse project is here. I have included a sample Main class to this project as well. To get the topic of this post, copy the current topic and decrypt it using “testKey2” file. Enjoy it :).
hi, i cant understand ur topic... wats dat mean?
ReplyDeleteaaah I got it, ur topic is encrypted :D
ReplyDelete