Finished the key part in SDES assignment