Gandalf- / Locknut-Encryption

File encryption through GUI or CLI
0 stars 0 forks source link

.doc files not encrypted or decrypted properly #1

Closed Gandalf- closed 10 years ago

Gandalf- commented 10 years ago

Running the program on .doc files breaks them. Comparing the contents of original file in plain text and the file after encryption-decryption has been run on it shows that some symbols aren't being put back. Some symbols may be missing entirely.

There used to be a bug similar to this that showed up even in plain text files in which "s and 's weren't being converted back properly. This was fixed by adding the modulo fix to the encryption algorithm.

        ;Check for max modulo case, fix if necessary
        (when (and (= 0 new-shift-amount) 
                   (not (= 0 (char->integer (car remaining-input)))))
          (set! new-shift-amount 200))

I assume that these issues are related but I'm not sure, and if they are, exactly how.

Gandalf- commented 10 years ago

The modulo function was the problem. .docx files are flagged as corrupt if they're changed in any way, even cutting and pasting a line back into the same place. Removing the modulo function seems to have removed the specific character errors.