 # Cryptography Basics

This tutorial will teach you some basics of cryptography that tells you how to encrypt your files using cryptographic algorithms and code.

With cryptography, you can encrypt any file so that only the authorized person can access to that encrypted file.

The main aim of cryptography is just to take the file or message (called plaintext) and encrypt it into ciphertext in such a way that only the authorized person know how to convert the message or file back to the plaintext for their uses.

The secrecy depends on the parameters to the algorithms called keys.

Now, let's suppose that, if P is plaintext file, KE is encryption key, C is ciphertext, and E is encryption algorithm, that is, function, then
C = E(P, KE)
is the definition of encryption.

The above equation of the encryption says that the ciphertext is obtained by using the known encryption algorithm, E, with plaintext, P and the secret encryption key, KE, as parameters.

Similarly,
P = D(C, KD)
where, D is decryption algorithm and KD is decryption key.

Now, this equation says that, to get the plaintext, P, back from the encrypted text, that is, ciphertext, C, and the decryption key, KD one runs the algorithm D with C and KD as parameters.

Here is an example that shows how to encrypt/decrypt files using cryptography in C and C++ programming languages:

Cryptograhpy is a very long and hard topic to learn. Suppose, you have placed your secret file in a secret place in your computer system, but if anyone find that file from that secret place, then he/she can access that file, but if that file is encrypted then he/she can't see the content of the file after accessing the file.

Tools
Calculator