refactoring encryptor