Finish encrypt function