added encrypt function