add Register function and Encrypt function