Implemented more of encrypt. Resolved some issues with the values of state and temp in encrypt.