Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.