
Hi... does anybody send me the code for encrypt and decrypt a file using caesar cipher and transposition cipher, substitution cdipher in single program... How to combine these 3 ciphers in a single program............. pls send me guys..

Here is a code of encryption and decryption string.Similarly you can encrypt and decrypt the file data.
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
class EncryptAndDecrypt {
public static void main (String[] args) throws Exception{
SecretKeyFactory key = SecretKeyFactory.getInstance("DES");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
byte[] desKeyData = { (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06, (byte)0x07, (byte)0x08 };
DESKeySpec desKeySpec = new DESKeySpec(desKeyData);
Key keys = key.generateSecret(desKeySpec);
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, keys);
String st= "Welcome";
byte[] cleartext = null;
cleartext = st.getBytes();
byte[] ciphertext = null;
ciphertext = cipher.doFinal(cleartext);
System.out.println("the encrypted text is: " + ciphertext.toString());
cipher.init(Cipher.DECRYPT_MODE, keys);
byte[] cleartext1 = cipher.doFinal(ciphertext);
System.out.println("the decrypted cleartext is: " + new String(cleartext1));
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.