Challenge 9
Fix encrypt function and add sanity check
Challenge 10