Consolidated repetitive file encryption functions.