Coders Packet

Encryption Decryption using C++

By Priyanka Biswas

This small project implements the concept of encrypting user-entered text and decrypting it later using C++.

The project includes header files iostream (for standard input/output), conio.h (contains console input-output functions ), windows.h(contains declarations for all of the functions in the Windows API) and string.h(contains string functions).

A COORD structure that specifies the new cursor position, in characters within the console screen buffer is used.

The project has four user-defined functions which are as follows:

gotoxy(): setting the position of the cursor within the console by defining the coordinates of row and column of the character cell.

enc(): it takes user-entered character input text and its length and defining the pattern for encrypting the entered text.   

dec(): it takes user-entered character input text and its length and defining the pattern for decrypting the entered text                 

EncDec(): base function dealing with text to encrypt and decrypt and calling the enc() and dec() as per need.

Inside the main() function: Using do-while loop the home screen of the project is printed giving three options to the user i.e Encrypt, Decrypt and Quit. If Encrypt has opted from the menu the EncDec() is called setting 'Encrypt' as its actual parameter. If Decrypt has opted from the menu the EncDec() is called setting 'Decrypt' as its actual parameter and opting Quit will terminate the loop resulting in termination of the program.

The home screen of the project:


Encryption: The users enter the input text and get an encrypted text in returns.


Decryption: If we enter the same encrypted text to decrypt, then it returns the original text which was encrypted earlier.  


Download Complete Code


No comments yet