<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aman Goyal on Medium]]></title>
        <description><![CDATA[Stories by Aman Goyal on Medium]]></description>
        <link>https://medium.com/@goyalaman37246?source=rss-13eb87d7f00------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*apIe8kbdSvbFTKre</url>
            <title>Stories by Aman Goyal on Medium</title>
            <link>https://medium.com/@goyalaman37246?source=rss-13eb87d7f00------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 20:47:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@goyalaman37246/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deciphering the Hill Cipher and Rail Fence Cipher Algorithms]]></title>
            <link>https://medium.com/swlh/deciphering-the-hill-cipher-and-rail-fence-cipher-algorithms-6316eeae5fce?source=rss-13eb87d7f00------2</link>
            <guid isPermaLink="false">https://medium.com/p/6316eeae5fce</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[internity-foundation]]></category>
            <category><![CDATA[deciphering]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[cipher]]></category>
            <dc:creator><![CDATA[Aman Goyal]]></dc:creator>
            <pubDate>Sun, 21 Jun 2020 10:35:28 GMT</pubDate>
            <atom:updated>2020-06-21T22:37:54.486Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*1YyEPXrGr5MwON1XQFWlTQ.png" /></figure><p><strong>Encryption and Decryption!</strong> You definitely must have come across these words once in your lifetime. Let me start with a very basic question then. What comes to our mind when we hear these two words? Maybe some of us will think about a detective like Sherlock Holmes decoding a mysterious message while solving a case on the streets of London, some will think about the famous movie <em>‘The Imitation Game’</em> where the famous mathematician Alan Turing helps the cryptography team to decipher the German Enigma Code, which saved millions of lives during the world war.</p><p>So basically, <em>cryptography</em> is very important in the view of transmitting confidential messages which can be decoded by only a few who know how to decipher it and save the classified information from getting into the wrong hands. Of course, until they know the key to decipher it ;)</p><p>In cryptography, <strong><em>Encryption</em></strong> is the process of translating plain text data, usually called <em>plaintext</em> into something that appears to be random and meaningless, usually called <em>ciphertext.</em> <strong><em>Decryption</em></strong> is the process of converting ciphertext back to plaintext.</p><p>A symmetric key is used during both the encryption and decryption processes. To decrypt a particular piece of ciphertext, the key that was used to encrypt the data must be used.</p><p>The goal of every encryption algorithm is to make it as difficult as possible to decrypt the generated ciphertext without using the key. If a really good encryption algorithm is used, there is no technique significantly better than methodically trying every possible key. For such an algorithm, the longer the key, the more difficult it is to decrypt a piece of ciphertext without possessing the key.</p><p>We will be discussing two ciphering algorithms here, namely Hill Cipher Algorithm and Rail Fence Cipher Algorithm.</p><h3><strong>Climbing the Hill Cipher Algorithm</strong></h3><p><strong><em>Hill Cipher</em></strong> is a polygraphic substitution cipher based on linear algebra. Each letter is represented by a number modulo 26. Often the simple scheme A=0, B=1, …., Z=25 is used. Let us see the <em>step-wise breakdown</em> for encrypting a text using Hill Cipher:</p><ol><li>To encrypt a message using the Hill Cipher, we must first turn our plaintext into a column vector.</li><li>We also turn our keyword (same for encryption and decryption) into an invertible nxn key matrix.</li><li>We then perform matrix multiplication modulo 26 (length of the alphabets) on each vector.</li><li>These vectors are then converted back into letters, based on the scheme used, to produce the ciphertext.</li></ol><p>Considering an example would set the things straight for us. Let us take an example where:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/1*mcrNW_PUkCi2hOrEGKjlyw.png" /></figure><p>We have to encrypt the message ‘ACT’ (length, n=3). The key is ‘GYBNQKURP’ which can be written as the <strong>nxn matrix</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*rtMbthIew4yUFmCGuceRbA.jpeg" /><figcaption>Keyword written as the nxn matrix</figcaption></figure><p>Following is the <strong>pseudo code to generate the key matrix</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*kpTyY5FHQsozctn3_7cX-w.png" /></figure><p>The message ‘ACT’ is written as <strong>vector</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/92/1*wSB-KoQ-ms66sWwyy8LB2Q.jpeg" /><figcaption>Message written as the Column Vector</figcaption></figure><p>After performing matrix multiplication against modulo 26, the <strong>enciphered vector</strong> is given as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*gsoqlgQ3vKrRHfFE1vEDlQ.jpeg" /><figcaption>The Final Vector obtained after performing all the operations</figcaption></figure><p>As you can see from the column vector obtained after performing said operations, the enciphered text received corresponds to ‘POH’.</p><p>Following is the <strong>pseudo code to perform matrix multiplication modulo 26</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*3X-V6ZQV8EBxBRxrXVD_5g.png" /></figure><p>To<strong><em> decrypt</em></strong> a ciphertext encoded using the Hill Cipher, the majority of process is same as the encryption. We turn the ciphertext back into a vector, then simply multiply by the inverse matrix of the key matrix (IFKVIVVMI in letters).The <strong>inverse of the matrix</strong> used in the previous example is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*P2QS2WJhQ6jdHlnmrXweVQ.jpeg" /><figcaption>Inverse of the Key Matrix</figcaption></figure><p>Performing the<strong> inverse key matrix multiplication</strong> for the ciphertext ‘POH’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*d22gCv66n3OpNH5TUnIiRg.jpeg" /><figcaption>The original column vector obtained after decryption</figcaption></figure><p>The deciphered text corresponds to ‘ACT’, which is same as the original plaintext.</p><p><em>An important note: We should keep in mind that not every possible matrix is a possible key matrix. This is because, in order to decrypt, we need to have an inverse key matrix, and not every matrix is invertible. To determine it, see if the determinant is 0 or shares a factor other than 1, then the matrix will not have an inverse. If this is the case, a different key must be used, since otherwise the ciphertext will not be able to be decrypted.</em></p><p>A <strong>Github Repository link</strong> is attached at the end of the blog that contains the whole working code for encryption and decryption using Hill Cipher algorithm.</p><h3><strong>Tracking the Rail Fence Cipher Algorithm</strong></h3><p>The <strong><em>Rail Fence Cipher</em></strong> (also called a zigzag cipher) is a form of transposition cipher. It works by writing your message on alternate lines across the page, and then reading off each line in turn. Let us see the step-wise breakdown for encrypting a text using Rail Fence Cipher :</p><ol><li>To encrypt a message using the Rail Fence Cipher, firstly we need to have a key (same for encryption and decryption), which is the number of rows you are going to have for this cipher.</li><li>We then start writing the letters of the given plaintext down diagonally to the right side until the number of rows specified by the key is reached.</li><li>We then bounce back up in a similar way diagonally till we hit the first row again. Thus, the alphabets of the plaintext are written in a zig-zag manner.</li><li>This cycle continues till the end of plaintext is reached. The individual rows are then read in order to obtain the ciphertext.</li></ol><p>Considering an example would set the things straight for us. Let us take an example where: Plaintext is given as “defend the east wall” and number of rails (key)=3, then <strong>encryption process</strong> is as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*dVGb4zFPtrmw0-4oT-mvoQ.jpeg" /><figcaption>The Rail Fence Cipher with a key of 3</figcaption></figure><p><em>Note that at the end of the message we have inserted two letter “X”s, which are called as nulls and act as placeholders. This is done to make sure that the message fits neatly in to the grid, so that there are same number of letters on the top row and the bottom row.</em></p><p>Following is the <strong>pseudo code for the encryption process</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*buUYiuItWdTVUUrE5NVHpA.png" /></figure><p>Now reading the image row by row gives us the ciphertext as “DNETLEEDHESWLXFTAAX”.</p><p>Following is the<strong> pseudo code for reading the rail matrix row by row</strong> and forming the ciphertext:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*i2MW_jaD8y7w1WZD2EkYQA.png" /></figure><p>To <strong><em>decrypt</em></strong> a ciphertext encoded using the Rail Fence Cipher, we have to reconstruct the diagonal grid used to encrypt the message. We start writing the message, but leaving a star in place of the spaces yet to be occupied (as shown in the figure below). Gradually, you can replace all the stars with the corresponding letters and read the plaintext from the table in a similar manner as encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*3QU0-o24c_x6KBCzPPd8Dw.png" /><figcaption>Placing stars in the place of spaces to be occupied</figcaption></figure><p>Let us see the step-wise breakdown:</p><ol><li>We start by making a grid (rail matrix) with as many rows as the given key (number of rails) is, and as many columns as the length of the ciphertext.</li><li>We then place the first letter in the top left square and proceed diagonally downwards where the letters are present.</li><li>When we get back to the top row, we place the next letter in the ciphertext. We continue this process across the row, and start the next row when we reach the end.</li><li>We traverse the matrix in zig-zag manner to obtain the original plaintext.</li></ol><p>Following is the<strong> pseudo code for constructing the rail matrix for decryption</strong> of the ciphertext:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*6QOo8-f4sgxALV2Dz8bYng.png" /></figure><p>Following is the <strong>pseudo code for filling the rail matrix and reading it in a zig-zag manner</strong> in order to obtain the plaintext:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*pQ8mtFEpAGRd15NSVy7coA.png" /></figure><p><em>An important note: The Rail Fence Cipher is a very easy to apply transposition cipher. However, it is not particularly secure, since there are a limited number of usable keys, especially for short messages (for there to be enough movement of letters, the length of the message needs to be preferably 3 times the key). You could easily process these quickly by the hand or a computer.</em></p><h3><strong>Resources</strong></h3><p>Following <strong>Github Repository</strong> can be referred for the whole working code of Encryption and Decryption using Hill Cipher Algorithm and Rail Fence Cipher Algoirthm: <a href="https://github.com/AmanGoyal37246/Projects"><strong>Link</strong></a></p><h3><strong>References</strong></h3><ol><li><a href="https://www.geeksforgeeks.org/rail-fence-cipher-encryption-decryption/">Rail Fence Cipher — Encryption and Decryption</a></li><li><a href="https://www.geeksforgeeks.org/hill-cipher/">Hill Cipher</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6316eeae5fce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/deciphering-the-hill-cipher-and-rail-fence-cipher-algorithms-6316eeae5fce">Deciphering the Hill Cipher and Rail Fence Cipher Algorithms</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Importance of Being Coachable!]]></title>
            <link>https://medium.com/@goyalaman37246/importance-of-being-coachable-d542ac9e36a8?source=rss-13eb87d7f00------2</link>
            <guid isPermaLink="false">https://medium.com/p/d542ac9e36a8</guid>
            <category><![CDATA[remote-internship]]></category>
            <category><![CDATA[karate-kid]]></category>
            <category><![CDATA[coachable]]></category>
            <category><![CDATA[mentorship]]></category>
            <category><![CDATA[internity-foundation]]></category>
            <dc:creator><![CDATA[Aman Goyal]]></dc:creator>
            <pubDate>Sat, 30 May 2020 12:57:29 GMT</pubDate>
            <atom:updated>2020-05-30T12:57:29.587Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*kSlhB5SA9oQI99L_3YmljA.jpeg" /></figure><p>Amidst this COVID-19 pandemic, when there is a widespread uncertainty about one’s future, importance of learning has not diminished a bit. Be it online school/colleges or online courses or remote internships, everyone is trying to gain a skill or two out of this unprecedented situation.</p><p>I also got a chance to enhance my skills and polish them with the help of ‘Internity Foundation’ as I acquired a remote internship with them in the stream of Data Structures and Algorithms.</p><p>The very first session that we had with the CEO of Internity Foundation was centered on the role that a mentor plays in our lives and the<strong> importance of being coachable</strong>. Though I had heard the word ‘coachable’ for the very first time in my life, but I was somewhat able to understand its meaning.</p><p>If we simply break this word in two parts, we get ‘coach+able’, that is one who has the ability to be coached or the one who can simply absorb all the inputs given by the mentor and build a meaningful product from it. I was totally mesmerized by the concept and the power it holds. Basically, it is the key to success that many people underestimate.</p><p>To help us understand this concept more clearly, we were asked to watch three short clips from the movie ‘Karate Kid’, where the karate mentor was asking his apprentice to perform weird tasks like waxing the car, painting the fence and sanding the floor instead of teaching him karate. The kid was continuously perplexed about his mentor’s approach but kept on performing all the tasks anyways. In the conclusion video, we get to see how all the pieces of advice came together to make karate moves which were simply hidden in plain sight in the form of everyday tasks given by his mentor. This explains the importance of a mentor in our life but also how important it is to being coachable and listen to your mentor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hl8ECCN1uPlzhBT4uZ2LdQ.jpeg" /><figcaption>A scene from the movie ‘Karate Kid’</figcaption></figure><p>A person who is not coachable and doesn’t trust his mentor tends to fail without realizing this fact, as the mentor is more experienced and has faced similar circumstances before and knows every nooks and crannies of that field. The only thing that an apprentice can provide is his dedication, determination, discipline and trust in the ways of his coach. He will definitely succeed.</p><p>The rule of being coachable says, “Do as your coach says you to”. And never question your coach. The work may require you to come out of your comfort zone but you will achieve your goals.</p><p>This is the golden lesson that I learnt from this internship in the orientation session itself. Looking forward for learning more such life lessons along with technical skills.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d542ac9e36a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>