At least theoretically, a regression test that catches (some) refactoring errors seems feasible to me. You decide on a set of test workloads to run and make sure that the result (in this case the encrypted output) is identical before and after. After any non-refactoring change though you will need to update your expected test results.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds