Computing Magazine

Encrypts a File

Posted on the 22 April 2012 by In7rud3r
<a href="">affiliate marketing</a>

//Reads in a file & XORS all the characters with 0
//To decrypt the file simply run it through this program again
//Usage: FileEncrypt SourceFile DestinationFile

import java.util.StringTokenizer;
import java.util.*;
import java.awt.*;

public class FileEncrypt
public static void main(String[] pArgs) throws IOException
String oneLine;
String[] aStore = new String [100];
int i = 0;
int Return=-1;
File filen = new File(pArgs[0]);

FileInputStream theFile = new FileInputStream(pArgs[0]);
int FileSize =(int)filen.length();
byte Bytes[]=new byte[FileSize];;

String file1 = new String(Bytes);

FileOutputStream myOutput = new FileOutputStream(pArgs[1]);
for (int loop = i; i<FileSize; i++)
myOutput.write(Bytes[i] + 128);



Back to Featured Articles on Logo Paperblog