0% found this document useful (0 votes)
17 views3 pages

Program Title

Uploaded by

mi ka Sangu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Program Title

Uploaded by

mi ka Sangu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name Sandip Gangaram yedage Subject Information Security

Class T. Y B. TECH Semester 5

Roll Number 65 Batch T3

Practical No 04 Year 2024-25

❖ Program Title
Ceaser cipher analysis program.

❖ Program:
#include<stdio.h

>

#include<ctype.

h>int main()
{
char text[500], ch;

int key

printf("Enter a message to

encrypt: "); scanf("%s", text);

printf("Enter the key:

"); scanf("%d", & key);

int i;
for ( i = 0; text[i] != '\0'; ++i)
{
ch = text[i];
if (isalnum(ch))
{
if (islower(ch)) //Lowercase characters.
{
Ch = (ch - 'a' + key) % 26 + 'a';
}
if (isupper(ch)) // Uppercase characters.
{

ch = (ch - 'A' + key) % 26 + 'A';

}
if (isdigit(ch)) // Numbers.
{
ch = (ch - '0' + key) % 10 + '0';
}

else

printf("Invalid Message");

}
text[i] = ch; // Adding encoded answer.

printf("Encrypted message: %s",

text);return 0;

❖ Output

Enter a message to encrypt: GOODMORNING


Enter key: 3
Encrypted message: JRRGPRUQLQJ

Enter a message to encrypt: Today52


Enter key: 3
Encrypted message: Wrgdb52

Enter a message to encrypt: IS46@


Enter key: 3
Encrypted message: LV46@

You might also like