A cipher is a mathematical function (algorithm) or cryptographic system that is used to perform encryption or decryption on data. Before data is encrypted it is considered to be plaintext and can be read by anyone. After it is encrypted, it is known as ciphertext which is not readable by third parties. An algorithm is defined as a set of well defined instructions for a task which in this case is to encrypt or decrypt data.