<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prashant Pandey</title>
    <description>The latest articles on DEV Community by Prashant Pandey (@b2pacific).</description>
    <link>https://dev.to/b2pacific</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F299480%2F12819d36-fdfd-4c0e-860a-a2039abd2846.png</url>
      <title>DEV Community: Prashant Pandey</title>
      <link>https://dev.to/b2pacific</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/b2pacific"/>
    <language>en</language>
    <item>
      <title>How http became the https that we know today?</title>
      <dc:creator>Prashant Pandey</dc:creator>
      <pubDate>Sat, 30 Jan 2021 18:27:08 +0000</pubDate>
      <link>https://dev.to/b2pacific/how-http-became-the-https-that-we-know-today-1l6m</link>
      <guid>https://dev.to/b2pacific/how-http-became-the-https-that-we-know-today-1l6m</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zK3Rwdu2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.x-cart.com/wp-content/uploads/2017/02/http_to_https-1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zK3Rwdu2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.x-cart.com/wp-content/uploads/2017/02/http_to_https-1.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only difference that one can notice between http and https by just looking at the words is the letter &lt;strong&gt;s&lt;/strong&gt;, but this letter &lt;strong&gt;s&lt;/strong&gt; has quite a big story of it's own. The &lt;strong&gt;s&lt;/strong&gt; in https, adds security to the http protocol which was previously unencrypted, and it's understood if you know what both of these words stand for.&lt;/p&gt;

&lt;p&gt;http -&amp;gt; Hypertext Transfer Protocol&lt;br&gt;
https -&amp;gt; Hypertext Transfer Protocol Secure&lt;/p&gt;

&lt;p&gt;This all started around the very beginning of 1990s, when the Researchers at &lt;strong&gt;Netscape&lt;/strong&gt; felt the need of securing or more precisely encrypting the requests that were sent across oceans and continents over the Internet, jumping from one router to another, flowing through cables underneath the ocean, between computers(well at that time the World Wide Web comprised mainly of computers unlike today where we even have refrigerators connected to the internet), naked to anyone who could intercept them. But before they could start working on some type of &lt;strong&gt;Encryption Layer&lt;/strong&gt; or &lt;strong&gt;Model&lt;/strong&gt;, they first had to decide that where will the data be encrypted. They had 2 options, they could either encrypt some critical data of an http request and then send it over TCP in which case, the encryption model would solely be used with http, but the internet does not solely comprise of http requests, there are other protocols which are used to send data, or they could encrypt the IP packets, in which case there would be a problem of configuring routers so that they may be able to understand those packets after they are encrypted. So, the Researchers decided that they wanted this Encryption Model to work with any other protocol, they did not want it to be used only with the http protocol, for which they decided to put this protocol in &lt;strong&gt;between http and TCP layer&lt;/strong&gt; i.e whole of the http request will first be encrypted and then it would be sent over TCP.&lt;/p&gt;

&lt;p&gt;The very first version of the Security Protocol that was developed to secure http was SSL 1.0 (acronym for Secure Socket Layer 1.0) developed by the Researchers at Netscape, but this very version, SSL 1.0 was never made public, it was only used internally at Netscape. SSL 1.0 had many security flaws in it.&lt;/p&gt;

&lt;p&gt;In 1995 SSL 2.0 was published. This version also had some serious security flaws like it used the TCP &lt;strong&gt;FIN, ACK&lt;/strong&gt; packet to indicate the end of data which could easily be forged by an attacker, it also had no protection for the &lt;strong&gt;SSL handshake&lt;/strong&gt; that would be performed before the computers start sending encrypted data, which means that a man-in-the-middle attack could be carried out and there were some other flaws in addition to the above mentioned ones.&lt;/p&gt;

&lt;p&gt;After the release of SSL 2.0 &lt;strong&gt;Microsoft&lt;/strong&gt; tried to step into the picture by releasing it's own Security protocol &lt;strong&gt;The PCT&lt;/strong&gt; or &lt;strong&gt;The Private Communication Technology&lt;/strong&gt;. It was quite similar to the SSL 2.0 but with some of the security flaws taken care of.&lt;/p&gt;

&lt;p&gt;In 1996 SSL 3.0 was made published by Netscape. This version was better than 2.0 as it had SHA-1 based ciphers and also with the added security of &lt;strong&gt;Certificate Verification&lt;/strong&gt;. SSL 3.0 was the last Secure Socket Layer version that was published because after this it was renamed as &lt;strong&gt;Transport Layer Security&lt;/strong&gt;. So, SSL and TLS aren't different protocols they are they same.&lt;/p&gt;

&lt;p&gt;The SSL 3.0 had some features incorporated from PCT in addition to SSL 2.0. The IETF(Internet Engineering Task Force) decided that instead of coming up with different ideas to handle the same issue, they should work together and that is how TLS was born.&lt;/p&gt;

&lt;p&gt;It was not until 1999 that TLS 1.0 was published. There weren't drastic changes between SSL 3.0 and TLS 1.0. TLS 1.0 can be thought of as SSL 3.1.&lt;/p&gt;

&lt;p&gt;All the SSL versions were developed by Netscape and made public.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tim Dierks later wrote that these changes, and the renaming from "SSL" to "TLS", were a face-saving gesture to Microsoft, "so it wouldn't look [like] the IETF was just rubberstamping Netscape's protocol".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Source Wikipedia&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After TLS 1.0 there were three other versions of TLS 1.1, 1.2 and 1.3 that were published in 2006, 2008 and 2018 respectively, each having enhanced security features, removing the flaws of its predecessor.&lt;/p&gt;

&lt;p&gt;All the versions of SSL along with TLS 1.0, 1.1 and 1.2 have been deprecated because of some serious security flaws that were found in them or because they were prone to attacks that can't be prevented with the ciphers used in them.&lt;/p&gt;

&lt;p&gt;So, https is what it is, because of TLS that stands between http and TCP, there is no difference between them if we remove TLS.&lt;/p&gt;

</description>
      <category>security</category>
      <category>webdev</category>
      <category>writing</category>
    </item>
    <item>
      <title>C's Preprocessor</title>
      <dc:creator>Prashant Pandey</dc:creator>
      <pubDate>Wed, 25 Dec 2019 13:09:49 +0000</pubDate>
      <link>https://dev.to/b2pacific/c-s-preprocessor-2d7l</link>
      <guid>https://dev.to/b2pacific/c-s-preprocessor-2d7l</guid>
      <description>&lt;p&gt;We need not get terrified by the name &lt;strong&gt;Preprocessor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If we go by the definition from &lt;strong&gt;Wikipedia&lt;/strong&gt; then "&lt;em&gt;The C preprocessor or cpp is the macro preprocessor for the C and C++ computer programming languages. The preprocessor provides the ability for the inclusion of header files, macro expansions, conditional compilation, and line control&lt;/em&gt;". In simple words the Preprocessor is just like any other program which has a special task to process the programs written by us before it is compiled by the compiler. It basically&lt;br&gt;
expands our program and converts the program file from a ".c" extension to a ".I" extension after it is done with the processing(expanding) of the program.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now the question arises what will the preprocessor expand??
&lt;/h2&gt;

&lt;p&gt;We'll learn about that a bit later.&lt;/p&gt;

&lt;p&gt;The preprocessor provides us with several features known as the "&lt;strong&gt;Preprocessor Directives&lt;/strong&gt;".&lt;br&gt;
It is these &lt;strong&gt;Preprocessor Directives&lt;/strong&gt; which get expanded by the Preprocessor.&lt;/p&gt;

&lt;p&gt;Some of the &lt;strong&gt;Preprocessor Directives&lt;/strong&gt; are:-&lt;/p&gt;

&lt;h2&gt;
  
  
  Macro expansion
&lt;/h2&gt;

&lt;p&gt;This directive solves one of our most basic problems. Consider the following code snippet.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main()
{
    for(i=0;i&amp;lt;25;i++)
    {
        for(j=0;j&amp;lt;25;j++)
        {
            printf("%d", i);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now for example if we want both the loops in the above program to execute till i and j are less than 30 and not 25, we would then have to go to both the places and change 25 to 30.&lt;br&gt;
And what if there were ten loops in the main function and what if there were 2 more funtions. It would then be a tiring task. &lt;br&gt;
It is for this that we have Macro expansions. Now consider the following code snippet with using macro expansions.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#define LIMIT 25
main()
{
    for(i=0;i&amp;lt;LIMIT;i++)
    {
        for(j=0;j&amp;lt;LIMIT;j++)
        {
            printf("%d", i);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the above program you would observe something new and that is "#define LIMIT 25".&lt;br&gt;
This new line is known as a macro definition and LIMIT is known as macro template and 25 is known as macro expansion. Now if we want to change 25 to 30 then all that we had to do was to change 25 to 30 in the very first line of the program. And this change would be applicable for the other functions where LIMIT has been used.&lt;br&gt;
Now when the preprocessor processes the program file it replaces every LIMIT occurrence with 25.&lt;br&gt;
Macros can also be used to define functions. For example:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#define PRT(X,Y){\
                      printf("%d %d",X,Y);\
                }\
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the above example "\" is used so that the Preprocessor may know that the macro expansion is of multiple lines.&lt;br&gt;
Macro expansion have a disadvantage. Although they make the program run faster but they increase the size of the program. Functions make the program smaller and compact. If we use macro in our program at a hundred places then when the Preprocessor processes the program it will put macro expansion at all those hundred places thus increasing the size of the expanded source file. But in case of functions it will be called a hundred times. Passing the parameters in case of functions a hundred times and evaluating the function all those times makes the program run slower, whereas in case Macro expansion since it has already being processed by the Preprocessor it will only be evaluated once.&lt;/p&gt;

&lt;h2&gt;
  
  
  File Inclusion
&lt;/h2&gt;

&lt;p&gt;What if we are working on a big project. It would then be difficult to manage all the functionalities because the project file would be very big. So, we divide the project into many smaller files, which contains functions that control a particular task. This is where we need the help of "#include" directive. This directive is used to merge two or more files. When we include a particular program file or header file in a program then when the Preprocessesor processes the program it simply copies all the content of that file in the file being processed. Therefore it gets converted into one single file.Consider the following code snippet:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;hello.c&amp;gt;
main()
{
    print("Using a function from another file");
    fun();
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In the above program as you see that there is no function defined as fun() but still this program will execute without any errors, because a function fun() has already been defined in the file "hello.c". When the Preprocessor processes the above program it simply copies all the contents of the file "hello.c" in the above program therefore it is able to access the function fun().&lt;br&gt;
In addition to adding other program files we also add header files in our program. Header files are predefined programs which contain frequently used functions that we may include in our program.&lt;br&gt;
Files are included in a program using the include directive in two ways:&lt;/p&gt;

&lt;p&gt;#include   OR  #include "filename"&lt;/p&gt;

&lt;h2&gt;
  
  
  Conditional Compilation
&lt;/h2&gt;

&lt;p&gt;This directive can be very helpful in some situations like what if we had to skip over some part of the program. Yes, I know what you are thinking that this can also be done using comments. But what if that part of the program which we want to skip already has comments in it?? This is where conditional compilation comes into play. The syntax for this directive is as follows:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifdef macro name
statement 1;
statement 2;
statement 3;
#else
statement 4;
statement 5;
statement 6;
#endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The above statements will only be executed if the macro name is defined. We also have another option an alternative:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ifndef macro name
statement 1;
statement 2;
statement 3;
#else
statement 4;
statement 5;
statement 6;
#endif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The above statements will only be executed if the macro name has not being defined earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Miscellaneous Directives
&lt;/h2&gt;

&lt;h3&gt;
  
  
  undef Directive
&lt;/h3&gt;

&lt;p&gt;If we want to undefine some name then we use this directive. &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#undef PENTIUM
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The above statement would cause the definition of PENTIUM to be removed from the system.&lt;/p&gt;

&lt;h3&gt;
  
  
  pragma Directive
&lt;/h3&gt;

&lt;p&gt;The functions that are specified with the "#pragma startup " directive are called before the main function executed, and the functions that are specified with the "#pragma end " directive are called before the program terminates.&lt;br&gt;
We also have another pragma directive "pragma warn ". It tells the compiler whether or not we want to suppress a warning.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#pragma warn -rvl
#pragma warn -par
#pragma warn -rch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The above three statements would suppress the warnings for return value, parameter not used and unreachable code.&lt;/p&gt;

&lt;p&gt;In this post I tried to explain a concept of C language, that is mostly overlooked, in as simple way as possible. &lt;/p&gt;

</description>
      <category>c</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
