creating function for encrypt

encrypt function