Finished code for S1, and added shared-key encryption to password