Finished encryption function

finished encryption function