I have a java text file named "text_in.txt" which contains
IDESOFMARCH
which is 11 characters in length, how do I go about finding the length of this file and appending an 'X' character to the end of H so that the text may be broken up into blocks of 2 characters each to be used for RSA encryption/decryption.
Example: ID ES OF MA RC HX
I have a main() which calls the encrypt method from my rsa.java file (files, private, public keys)
code.encrypt(files, 17, 2773);
files contains "text_in.txt" and "text_out.txt" and a boolean true which opens both files.
The main is calling this:
public void encrypt(FileInOut files, int e, int n) {
//Get the in file length and add a 'X' if uneven character blocks
if((files.length() % 2) == 1)
files.write("X");
//Print a 0 in the encrypted file to represent the end of a line
if(files != char)
files.write("0");