Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.
Showing posts with label FON. Show all posts
Showing posts with label FON. Show all posts

What is the difference between HTTP and HTTPS?

HTTP Vs HTTPS
HTTP Vs HTTPS Protocol
HTTP and HTTPS both are protocol use to make request to web server for website access. The below are some simple difference between both protocol that can be easily understand by students and they can have clear concept about this both protocol, so can easily write in examination of subjects such as Network Security, Internet Basics, Networking, Fundamental of Networking etc.

HTTP Protocol HTTPS Protocol
URL of site begins with ‘http://’ for the site which uses http protocol. Example: http://www.google.com, http://www.indiastudychanel.com URL of site begins with ‘https://’ for the site which uses https protocol. Example: https://www.facebook.com https://www.paypal.com
HTTP stands to HyperText Transfer Protocol which is not secure means the data sent via this protocol can be hacked during transition process. HTTPs is used by sites which does not require security or other way it does not doing any secure transaction. Example of such site are business site, blog, informational site etc. Stands to HyperText Transfer Protocol via SSL which means Secure Socket Layer. HTTPS is more secure because data is encrypted before transmitting so now one can understand the data even if it hacked during transmission. Every online banking payment system uses HTTPS protocol for secure and reliable transition. Google’s Mail system also uses HTTPS for security of your mail.
It uses port 80 for internet communication.  It uses 443 for internet communication.
It operated on Application Layer of OSI protocol stack. It operated on Transport Layer of OSI protocol stack because it deals with data encryption and decryption.
No certificate required for HTTP protocol. There is requirement of certificate for HTTPs protocol.
No certificates required Certificates required

The small animation given below is very helpful to understand concept of both protocol. The animation shows you how data travels on internet via physical medium in both protocol, what can be happened with data i.e hacked, destroyed, stalled and other known issues like phishing. I recommend all students who have interest in networking must see this video. The credit for this video creation goes to NetworkingForAll.




Program to Encode the Message Using Mono Alphabetic Sub-Stitution Cipher

#include<stdio.h>

char monocipher_encr(char);
char alpha[27][3]={
{'a','f'}, {'b','a'}, {'c','g'}, {'d','u'}, {'e','n'}, {'f','i'}, {'g','j'}, {'h','k'}, {'i','l'}, {'j','m'}, {'k','o'}, {'l','p'}, {'m','q'}, {'n','r'}, {'o','s'}, {'p','t'}, {'q','v'}, {'r','w'}, {'s','x'}, {'t','y'}, {'u','z'}, {'v','b'}, {'w','c'}, {'x','d'}, {'y','e'}, {'z','h'}
};
char str[20];

int main()
{
        char str[20],str2[20];
        int i;
        printf("\n Enter String..");
        gets(str);
        for(i=0;str[i];i++)
                str2[i]=monocipher_encr(str[i]);
        printf("\n Before Decryption..%s",str);
        printf("\n After Decryption..%s\n",str2);
}
char monocipher_encr(char a)
{
        int i;
        for(i=0;i<27;i++)
        {
                if(a == alpha[i][0])
                        break;
        }
        return alpha[i][1];
}

Program to Encode the Message Using Caecer Cipher.

#include<stdio.h>
#include<string.h>

char ciper_en(char);
char ciper_dn(char);
char a[27]={'a','b','c','d','e','f','g','h','i','j','k','l','m',
                     'n','o','p','q','r','s','t','u','v','w','x','y','z',' '};
int main()
{
        char s[10],s1[20],s2[20];
        int i,j;
        printf("\n Enter the string:");
        gets(s1);
        for(i=0;s1[i];i++)
                s2[i]=ciper_en(s1[i]);
        for(j=0;s2[j];j++)
                s[j]=ciper_dn(s2[j]);
        printf(" \n Before Decryption ...%s ", s1);
        printf(" \n After Decryption ...%s\n ", s2);
        printf(" \n After Encryption...%s \n ", s);

}

 
char ciper_en(char a1)
{
        int i;
        if(a1==' ')
                return a1;

        for(i=0;i<26;i++)
        {
                if(a[i]==a1)
                {
                        break;
                }
        }
        return a[(i+3)%26];
}


char ciper_dn(char a1)
{
        int i;
        static int n=1;
        if(a1==' ')
                return a1;
        for(i=0;i<26;i++)
        {
                if(a[i]==a1)
                {
                        break;
                }
        }
        if(i<=2)
                i=(25+i+1);
        return a[(i-3)%26];
}

Program to Generate the Polynomial Equation for Frame Bit

#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<malloc.h>
struct s
{
        int seq_no,frame[10],parity;
}s1[20],tmp[20];
struct poly
{
        int data,p;
        struct poly *link;
}*start;
void parityCount(struct s[]);
void print(struct s[]);
void sender(int *,int);
void reciver(struct s[]);
void poly();
void polydisplay();
int main()
{
        char str[20];
        int i,j,as,q,arr[10],a[50],n,k;
        printf("Enter any string..");
        scanf("%s",str);
        start=NULL;
        n=0;
        printf("\n\n String in binary..\n\n");
        for(j=0;str[j];j++)
        {
                i=0;
                as=toascii(str[j]);
                q=as;
                while(q!=1)
                {
                        arr[i++]=q%2;
                        q/=2;
                }
                arr[i++]=1;
                for(k=i-1;k>=0;k--)
                        a[n++]=arr[k];
        }
        for(j=0;j<n;j++)
                printf("%d",a[j]);
        printf("\n");
        sender(a,n);
        poly();
        polydisplay();
        return 0;
}
int len;
void sender(int a[],int i)
{
        int j,no=0,k;
        len=i/10;
        if(i%10==0)
                len--;
        for(j=0;j<=len;j++)
        {
                s1[j].seq_no=(j+1);
                for(k=0;k<10;k++)
                {
                        if(no!=i)
                                s1[j].frame[k]=a[no++];
                }
        }
        parityCount(s1);
        printf("\n Sending data..\n\n");
        print(s1);
}

void poly()  // For creating the polynomial using structure.
{
        int i,j,k;
        struct poly *q,*tmp;
        printf("\nenterd into poly..\n");
        for(i=0;i<=len;i++)
        {
                k=9;
                for(j=0;j<10;j++)
                {
                        if(start==NULL)
                        {
                                start=(struct poly*)malloc(sizeof(struct poly));
                                start->data=s1[i].frame[j];
                                start->p=k--;
                                start->link=NULL;
                        }
                        else
                        {
                                q=start;
                                while(q->link!=NULL)
                                        q=q->link;
                                tmp=(struct poly*)malloc(sizeof(struct poly));
                                tmp->data=s1[i].frame[j];
                                tmp->p=k--;
                                tmp->link=NULL;
                                q->link=tmp;
                        }
                }
        }
}


 
void polydisplay() // Display the polynomial.
{
        struct poly *temp;
        temp=start;
        int i=0;
        while(temp!=NULL)
        {
                if(i==10)
                {
                        i=0;
                        printf("\n");
                }
                if(temp->data!=0)
                {
                        if(temp->p==0)
                                printf("  + 1");
                        else
                                printf(" x ^ %d +",temp->p);
                }
                temp=temp->link;
                i++;
        }
        printf("\n");
}

void parityCount(struct s *s1)
{
        int ans=0,j,k;
        for(j=0;j<=len;j++)
        {
                for(k=0;k<10;k++)
                        ans=ans ^ s1[j].frame[k];
                s1[j].parity=ans;
        }
}



void print(struct s s1[])
{
        int j,k;
        for(j=0;j<=len;j++)
        {
                printf("\n\t%d \t ",s1[j].seq_no);
                for(k=0;k<10;k++)
                        printf("%d",s1[j].frame[k]);
                printf("\t %d ",s1[j].parity);
                printf("\n");
        }
}

Program to Create the Hamming Code for Given Message

#include<stdio.h>
#include<ctype.h>
#include<string.h>
int power(int,int);
void hamming();
int a[50],n;
int main()
{
        char str[20];
        int i,j,as,q,arr[10],k;
        printf("Enter any string..");
        scanf("%s",str);
        n=0;
        printf("\n\n String in binary..\n\n");
        for(j=0;str[j];j++)
        {
                i=0;
                as=toascii(str[j]);
                q=as;
                while(q!=1)
                {
                        arr[i++]=q%2;
                        q/=2;
                }
                arr[i++]=1;
                for(k=i-1;k>=0;k--)
                        a[n++]=arr[k];
        }
        printf("\n Before adding checkbits..\n");
        hamming();
        return 0;
}



void hamming()
{
        int h[10][11],i,j;
        int len=n/7,no=0,c=0,k;
        int index[4][5]={
{3,5,7,9,11}, {3,6,7,10,11}, {5,6,7,0,0}, {9,10,11,0,0}
      };
        int p[4]={1,2,4,8};
        for(i=0;i<len;i++)
        {
                for(j=1;j<=11;j++)
                {
                        if(j!=1 && j!=2 && j!=4 && j!=8)
                                h[i][j]=a[no++];
                        else
                                h[i][j]=0;
                }
        }
        for(i=0;i<len;i++)
        {
                printf("\n");
                for(j=1;j<=11;j++)
                {
                        if(j!=1 && j!=2 && j!=4 && j!=8)
                                printf("  %d",h[i][j]);
                }
        }

 
        for(i=0;i<len;i++)
        {
                for(k=0;k<4;k++)
                {
                        for(j=0;j<5;j++)
                        {
                                if(index[k][j]!=0)
                                        h[i][p[k]]=h[i][p[k]] ^ h[i][index[k][j]];
                        }
                }

        }
        printf("\n\n CodeWords \n");
        for(i=1;i<=11;i++)
                printf("  %d",i);
        printf("\n  ---------------------------------\n");

        for(i=0;i<len;i++)
        {
                printf("\n");
                for(j=1;j<=11;j++)
                        printf("  %d",h[i][j]);
        }
        printf("\n");
}

int power(int n,int c)
{
        int i,p=1;
        for(i=1;i<=c;i++)
                p=2*p;
        return p;
}

Program to stuff the Byte After Specified Characters

#include<stdio.h>
#include<string.h>

int main()
{
        char str[20],str1[5][10];
        int i,j,len,no,n;
        printf("\n Enter message..\n");
        scanf("%s",str);
        printf("\n Enter no to byte stuffing..");
        scanf("%d",&n);
        no=0;
        len=strlen(str)/n;
        if(strlen(str)%n==0)
                len--;
        for(i=0;i<=len;i++)
        {
                str1[i][0]='*';
                str1[i][n+1]='*';
                for(j=1;j<=n;j++)
                {
                        if(no!=strlen(str))
                                str1[i][j]=str[no++];
                        else
                                str1[i][j]='#';
                }
        }
        for(i=0;i<=len;i++)
        {
                printf("\n Iteration : %d :",i+1);
                for(j=0;j<=n+1;j++)
                         printf("%c",str1[i][j]);
        }
        return 0;
}

Program to Shift One Bit to Left or Right.

#include<stdio.h>
#include<stdio.h>

int main()
{
 int a,ar[10],q,i=0,j;
 clrscr();
 printf("\n Enter the Number:");
 scanf("%d",&a);
 q=a;
 printf("\n In Binary :");
 while(q!=1)
 {
  ar[i]=q%2;
  q/=2;
  i++;
 }
 ar[i]=1;
 printf("\n");
 for(j=i;j>=0;j--)
  printf("%d",ar[j]);
 printf("\n In ASCII : %d",a);
 a=a >> 1;  // Here right shift 1 bit. 
 q=a;   i=0;
 while(q!=1)
 {
  ar[i]=q%2;
  q/=2;
  i++;
 }
 ar[i]=1;
 for(j=i;j>=0;j--)
  printf("%d",ar[j]);
 printf("\n In Ascii..%d",a);
return 0;
}

Write a Program to convert the ASCII to binary & Binary to ASCII

#include<stdio.h>
#include<stdio.h>
#include<ctype.h>
#include<math.h>
int main()
{
 int a,q,i=0,j,ans=0;
 int arr[10];
 char c;
 clrscr();
 printf("\n Enter any character :");
 scanf("%c",&c);
 a=toascii(c);
 q=a;
 printf("\n\n%d",q);
 while(q!=1)
 {
  arr[i]=q%2;
  q/=2;
  i++;
 }
 arr[i]=1;
 printf("\nAscii To Binary..\n");
 for(j=i;j>=0;j--)
  printf("%d",arr[j]);
 for(j=i;j>=0;j--)
 {
  if(arr[j]==1)
   ans+=pow(2,j);
 }
 printf("\n Binary to Ascii..%d & Char .. %c\n",ans,ans);
return 0;
}

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes