Implement Mono Alphabetic Cipher Encryption.

Aim: Implement Mono Alphabetic Cipher Encryption.

There are a number of different types of substitution cipher. If the cipher operates on single letters, it is termed a simple substitution cipher; a cipher that operates on larger groups of letters is termed polygraphic.

A monoalphabetic cipher uses fixed substitution over the entire message, whereas a polyalphabetic cipher uses a number of substitutions at different positions in the message, where a unit from the plaintext is mapped to one of several possibilities in the ciphertext and vice versa.

C Program Code:


#include<stdio.h>
#include<conio.h>
void main()
{
    char pt[30] ,c[27], ct[30];
    int i, j, index;
    clrscr();
    printf("\n\nImplement Mono Alphabetic Cipher Encryption-Decryption.");
    printf("\nEnter Plain Text : ");
    gets(pt);

    printf("\nEnter Key From a to z : \n");
    for(i = 0; i < 26; i++)
    {
        printf("%c-", i + 97);
        c[i] = getch();
        printf("%c , ", c[i]);
    }

    for(i = 0; i < strlen(pt); i++)
    {
        index = pt[i] - 97;
        ct[i] = c[index];
    }

    printf("\n\nCipher Text is : ");
    for(i = 0; i < strlen(pt); i++)
    {
        printf("%c", ct[i]);
    }
    getch();
}
            



Output:

Post a Comment

5 Comments