01 Dec 2009 @ 4:18 PM 
public static String encryptBlowfish(String to_encrypt, String strkey) {
  try {
    SecretKeySpec key = new SecretKeySpec(strkey.getBytes(), "Blowfish");
     Cipher cipher = Cipher.getInstance("Blowfish");
     cipher.init(Cipher.ENCRYPT_MODE, key);
     return new String(cipher.doFinal(to_encrypt.getBytes()));
  } catch (Exception e) { return null; }
}
 
public static String decryptBlowfish(String to_decrypt, String strkey) {
  try {
     SecretKeySpec key = new SecretKeySpec(strkey.getBytes(), "Blowfish");
     Cipher cipher = Cipher.getInstance("Blowfish");
     cipher.init(Cipher.DECRYPT_MODE, key);
     byte[] decrypted = cipher.doFinal(to_decrypt.getBytes());
     return new String(decrypted);
  } catch (Exception e) { return null; }
}
Posted By: Zayin
Last Edit: 01 Dec 2009 @ 04:18 PM

EmailPermalink
Tags
Tags: , , ,
Categories: java


 

Responses to this post » (3 Total)

 
  1. zayinkrige says:

    New Blog Post -> Using Blowfish encrypt/decrypt in JAVA – http://www.zayinkrige.com/using-blowfish

  2. Onnie says:

    Hi.
    I need help,,, I want to encrypt mysql database with joomla but i don’t know which software to use and how to do everything… please help

  3. Zayin says:

    contact me : zkrige @ gmail dot com

Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.


 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 38
  • Comments » 61
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Links



    No Child Pages.

Portfolio



    No Child Pages.