refactor encryptor.rb with private methods