import javax.crypto.
Cipher;
import javax.crypto.SecretKey;
import java.io.FileInputStream;
import java.security.KeyStore;
public class BlowFish{
static class RC4{
private byte[] S=new byte[256];
private int i=0;
private int j=0;
public RC4(byte[] key){
initialize(key);
}
private void initialize(byte[] key){
for(int i=0;i<256;i++){
S[i]=(byte)i;
int j=0;
for(int i=0;i<256;i++)
{
j=(j+S[i]+key[i%key.length])&0xFF;
byte temp=S[i];
S[i]=S[j];
S[j]=temp;
}
}
public byte[] emcryptDecrypt(byte[] data){
byte[] result=new byte[data.length];
for(int k=0;k<data.length;k++)
{
i=(i+1)&0xFF;
j=(j+S[i])&0xFF;
byte temp=S[i];
S[i]=S[j];
S[j]=temp;
int t=(S[i]+S[j])&0xFF;
result[k]=(byte)(data[k]^S[t]);
}
return result;
}
}
public static void main(String[] args) throws Exception
{
String text="Helloworld";
Stri9ng rc4KeyString="SecretKey";
System.out.println("===RC4 Encryption/Decryption===");
RC4 rc4=new Rc4(