tis is urgent - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

tis is urgent

Write a shell program to cipher all the text/content in any text document in the current working directory and also use another shell program to decipher it to read. Use any scheme for ciphering.

Comments

  • zibadianzibadian Posts: 6,349Member
    : Write a shell program to cipher all the text/content in any text
    : document in the current working directory and also use another shell
    : program to decipher it to read. Use any scheme for ciphering.
    :
    Here's the encryption program:
    [code]
    class EncryptData {

    public static void main(String[] args) {
    if (args.length < 2) return;
    try {
    InputStream is = new BufferedInputStream(new FileInputStream(args[0]));
    OutputStream os = new CipherOutputStream(new FileOutputStream(args[1]), Cipher.getInstance("DES/CBC/PKCS5Padding"));
    byte[] buffer = new byte[1024];
    int i = 0;
    while (i > -1) {
    i = is.read(buffer, 0, buffer.length);
    if (i > 0) os.write(buffer, 0, i);
    }
    os.close();
    is.close();
    } catch (Exception e) {
    }
    }
    }
    [/code]
Sign In or Register to comment.