encrypt implement and fix bug in hw6.c