Page 1 of 1

Blowfish Decrypt Algorithm

PostPosted: Sun Jan 29, 2012 2:47 pm
by Illico
I would like to use a Blowfish Decrypt Algorithm ( mode ECB) for a plugin development, how can I add it on my groovy script?

Re: Blowfish Decrypt Algorithm

PostPosted: Sun Jan 29, 2012 4:44 pm
by zip
Im not sure if its a part of core Java. If yes it should not be a problem. Check the plugin guide, there is a link to Javadoc. Otherwise look at 4od plugin which includes algorithm similar to Blowfish.

Re: Blowfish Decrypt Algorithm

PostPosted: Sun Jan 29, 2012 7:52 pm
by Illico
Found !!
File decrypted !
import java.security.Key
import javax.crypto.spec.SecretKeySpec
import javax.crypto.Cipher

Thanks

Re: Blowfish Decrypt Algorithm

PostPosted: Sun Jan 29, 2012 9:47 pm
by zip
Cant you use one of the shared methods in the plugin sdk? It uses these classes as well.

Re: Blowfish Decrypt Algorithm

PostPosted: Mon Jan 30, 2012 9:04 am
by Illico
Are you talking about these shared methods?
String decryptAES(String hexText, String key, String iv)
String generateMAC(String text, String hash, String algorithm)

I don't know how to use them.

EDIT: I use this method:
import java.security.Key
import javax.crypto.spec.SecretKeySpec
import javax.crypto.Cipher

  Code:
   public String MyDecrypt(byte[] data,byte[] key){
      try
      {
         Key clef = new SecretKeySpec(key,"DES");
         Cipher c = Cipher.getInstance("DES");
         c.init(Cipher.DECRYPT_MODE,clef);
         return new String(c.doFinal(data));
      }
         catch (Exception e)
      {
         System.out.println(e);
      return null;
      }   
   }



"DES" algorithm could be added to the method parameters.

http://docs.oracle.com/javase/1.4.2/doc ... Guide.html

Re: Blowfish Decrypt Algorithm

PostPosted: Mon Jan 30, 2012 9:50 am
by zip
ok, that is a bit different, i'll add this to a future version.