Pergunta de entrevista da empresa Microsoft

Q: How would you write this encryption function?