DES,Blowfish,AES(rijndael),RC4
import javax.crypto.*;
import java.util.*;
public class Blowfish
{
public static void main(String[] args)throws Exception
{
SecretKey key=KeyGenerator.getInstance("BlowFish").generateKey();
Cipher cip=Cipher.getInstance("BlowFish");
cip.init(Cipher.ENCRYPT_MODE,key);
Scanner s=new Scanner(System.in);
String pt=s.next();
byte[] encrypted=cip.doFinal(pt.getBytes());
cip.init(Cipher.DECRYPT_MODE,key);
byte[] ct=cip.doFinal(encrypted);
System.out.println("the new encrypted string is"+new String(encrypted)+"old string is"+new String(ct));
}
}
Comments
Post a Comment