Finished the implementation of encryption routines.