|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.blowfishj.BlowfishEasy
Support class for easy string encryption with the Blowfish algorithm. Works in CBC mode with a SHA-1 key setup and correct padding - the purpose of this class is mainly to show a possible implementation with Blowfish.
Constructor Summary | |
BlowfishEasy(char[] passw)
Constructor to use string data as the key. |
|
BlowfishEasy(java.lang.String sPassword)
Deprecated. use the BlowfishEasy(char[]) instead, since this constructor discards the higher 8 bits of every 16bit Unicode character; be aware that this constructor will produce non-compatible results to the new method! |
Method Summary | |
java.lang.String |
decryptString(java.lang.String sCipherText)
Decrypts a hexbin string (handling is case sensitive). |
void |
destroy()
Destroys (clears) the encryption engine, after that the instance is not valid anymore. |
java.lang.String |
encryptString(java.lang.String sPlainText)
Encrypts a string (treated in Unicode) using the internal random generator. |
java.lang.String |
encryptString(java.lang.String sPlainText,
java.util.Random rndGen)
Encrypts a string (in Unicode). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BlowfishEasy(java.lang.String sPassword)
sPassword
- the passwordpublic BlowfishEasy(char[] passw)
passw
- the password, usually gained by String.toCharArray()Method Detail |
public java.lang.String encryptString(java.lang.String sPlainText)
sPlainText
- string to encrypt
public java.lang.String encryptString(java.lang.String sPlainText, java.util.Random rndGen)
sPlainText
- string to encryptrndGen
- random generator (usually a java.security.SecureRandom
instance)
public java.lang.String decryptString(java.lang.String sCipherText)
sCipherText
- hexbin string to decrypt
public void destroy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |