Hitachi Vantara Interview Question

Write a function to encrypt a string based on the shift integer.