<?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 Arunarka Mukhopadhyay on Medium]]></title>
        <description><![CDATA[Stories by Arunarka Mukhopadhyay on Medium]]></description>
        <link>https://medium.com/@arumukherjee121?source=rss-e140ce4f08e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*CpDihl624Bp_ciZz</url>
            <title>Stories by Arunarka Mukhopadhyay on Medium</title>
            <link>https://medium.com/@arumukherjee121?source=rss-e140ce4f08e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:56:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arumukherjee121/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[Beyond Bletchley Park: Unlocking the Secrets of World War II Encryption in Python]]></title>
            <link>https://medium.com/@arumukherjee121/beyond-bletchley-park-unlocking-the-secrets-of-world-war-ii-encryption-in-python-0ecc772b7c18?source=rss-e140ce4f08e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ecc772b7c18</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[numbers]]></category>
            <dc:creator><![CDATA[Arunarka Mukhopadhyay]]></dc:creator>
            <pubDate>Sun, 07 Apr 2024 06:12:07 GMT</pubDate>
            <atom:updated>2024-04-07T06:12:07.698Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Enigma</em></strong><em>: that which is hard to understand or explain</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QcPk9ZDE3yTFwinp-OeDUw.png" /><figcaption>(The Enigma Machine; source: <a href="https://digitaldaze.io/enigma-paved-the-way-for-modern-computers/">https://digitaldaze.io/enigma-paved-the-way-for-modern-computers/</a>)</figcaption></figure><p>In the early to mid-20th century, in the capstone of World War II, the German military developed an encryption machine which would prove to be a powerful influence in its vast military communications. The device was so far ahead of its time that mathematicians and engineers all over the world went on the crusade to solve it, firstly, as a way to get vantage in the war, and secondly, to test the limits of human intelligence. It was the zenith of German engineering. Many took the challenge and floundered, however, it was eventually cracked through persistence.</p><p>The initial breakthrough in deciphering the Enigma machine is credited to a team of Polish mathematicians: Marian Rejewski, Jerzy Różycki, and Henryk Zygalski, all affiliated with Poznań University. Through their dedicated theoretical analysis and practical simulations, they achieved a significant cryptanalytic feat that laid the groundwork for Allied codebreaking efforts during World War II. While the Enigma’s decryption did not directly lead to the fall of the Axis Powers, it undoubtedly provided invaluable intelligence that contributed to the Allied victory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*iZZPWY0720MUGlg1tqFUaw.jpeg" /><figcaption>(Source: <a href="https://legionmagazine.com/cracking-the-enigma/">https://legionmagazine.com/cracking-the-enigma/</a>)</figcaption></figure><p>Since then, cryptography enthusiasts and hackers all over the globe has tried to reverse engineer and delve deeper into the mathematics of it.</p><p>The constituent parts of an Enigma Machine is as follows:</p><ol><li>The plugboard: responsible for simple letter swaps</li><li>The keyboard: responsible for taking input from operator</li><li>The rotors: its wirings, and notches, it was responsible for complex letter transpositions</li><li>The reflector: responsible for further swapping and reverse rotor transpositions</li><li>The lampboard; displaying the output by lighting up a lamp corresponding to a letter</li></ol><p>The next section provides a Python implementation to mimic the working of the Enigma machine. The implementation is rather simple but is effective in recapitulating the way the actual device worked.</p><pre>class EnigmaMachine:<br>    def __init__(self):<br>        &quot;&quot;&quot;Constructor to initialise the fields of the class&quot;&quot;&quot;<br>        <br>        self.alphabet = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;<br>        self.rotor1 = &quot;EKMFLGDQVZNTOWYHXUSPAIBRCJ&quot;<br>        self.rotor2 = &quot;GLJDXWHBASMQFNEUCVRPIOZYKT&quot;<br>        self.rotor3 = &quot;VCQKSXFDIHYAEMLJRPBGTNZWOU&quot;<br>        self.reflector = &quot;YRUHQSLDPXNGOKMIEBFZCWVJAT&quot;  # A simple reflector<br><br>        # Initial rotor positions<br>        self.position1 = 0<br>        self.position2 = 0<br>        self.position3 = 0<br><br>        # Set initial rotor positions<br>        self.reset_rotors()<br><br>    def reset_rotors(self, position1=0, position2=0, position3=0):<br>        &quot;&quot;&quot;Reset the rotors to the given positions or 0 for default&quot;&quot;&quot;<br>        <br>        self.position1 = position1<br>        self.position2 = position2<br>        self.position3 = position3<br><br>    def encrypt(self, message):<br>        &quot;&quot;&quot;Iterate through the raw text and replace the char with _encrypt_char() for all alphabetic characters&quot;&quot;&quot;<br>        <br>        encrypted_message = &quot;&quot;<br>        for char in message:<br>            if char.upper() in self.alphabet:  # Encrypt only alphabet characters<br>                char = self._encrypt_char(char.upper())<br>            encrypted_message += char<br>        return encrypted_message<br><br>    def _encrypt_char(self, char):<br>        &quot;&quot;&quot;The Enigma encryption algorithm, replicating the behaviors of rotors and reflector&quot;&quot;&quot;<br>        <br>        # Pass through rotors<br>        offset1 = self.alphabet.index(char)<br>        char1 = self.rotor1[(offset1 + self.position1) % 26]<br>        offset2 = self.alphabet.index(char1)<br>        char2 = self.rotor2[(offset2 + self.position2) % 26]<br>        offset3 = self.alphabet.index(char2)<br>        char3 = self.rotor3[(offset3 + self.position3) % 26]<br><br>        # Reflector<br>        reflected_char = self.reflector[self.alphabet.index(char3)]<br><br>        # Pass back through rotors (in reverse)<br>        char3_back = self.alphabet[self.rotor3.index(reflected_char)]<br>        offset3_back = (self.alphabet.index(char3_back) - self.position3) % 26<br>        char2_back = self.alphabet[self.rotor2.index(self.alphabet[offset3_back])]<br>        offset2_back = (self.alphabet.index(char2_back) - self.position2) % 26<br>        char1_back = self.alphabet[self.rotor1.index(self.alphabet[offset2_back])]<br>        offset1_back = (self.alphabet.index(char1_back) - self.position1) % 26<br><br>        # Update rotor positions (simple rotation for this simulation)<br>        self.position1 = (self.position1 + 1) % 26<br>        if self.position1 == 0:  # Rotor 1 completes a full rotation<br>            self.position2 = (self.position2 + 1) % 26<br>            if self.position2 == 0:  # Rotor 2 also completes a full rotation<br>                self.position3 = (self.position3 + 1) % 26<br><br>        return self.alphabet[offset1_back]<br><br># Example usage<br>enigma = EnigmaMachine()<br>original_message = &quot;GERMAN ENGINEERING IS FINEST&quot;<br>encrypted_message = enigma.encrypt(original_message)<br>print(&quot;Original Message:&quot;, original_message)<br>print(&quot;Encrypted Message:&quot;, encrypted_message)<br><br># Decrypting would simply mean running the encrypted message through the same process<br>enigma.reset_rotors()  # Reset rotors to the initial position for decryption<br>decrypted_message = enigma.encrypt(encrypted_message)<br>print(&quot;Decrypted Message:&quot;, decrypted_message)</pre><p>The Enigma machine stands as a remarkable feat of engineering, its intricate design and evolving features posing a significant challenge during World War II. The combined efforts of Allied codebreakers, spearheaded by the brilliance of Alan Turing, and the development of new technologies ultimately led to its decryption.</p><p>Today, the ability to simulate the Enigma machine using Python exemplifies the remarkable advancements in computing power and our understanding of cryptography. Python’s clear syntax and extensive libraries empower researchers, students, and enthusiasts to explore the Enigma’s inner workings. This accessibility fosters a deeper appreciation for its historical significance and the ongoing evolution of cryptographic methods.</p><p>References:<br>1. <a href="https://en.wikipedia.org/wiki/Enigma_machine">https://en.wikipedia.org/wiki/Enigma_machine</a></p><p>2. <a href="https://www.cryptomuseum.com/crypto/enigma/hist.htm">https://www.cryptomuseum.com/crypto/enigma/hist.htm</a></p><p>3. <a href="https://www.tandfonline.com/doi/abs/10.1080/0161-119591883773">https://www.tandfonline.com/doi/abs/10.1080/0161-119591883773</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ecc772b7c18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distributed Denial of Service: The Attack and Defense]]></title>
            <link>https://medium.com/@arumukherjee121/distributed-denial-of-service-the-attack-and-defense-befbfb84f49c?source=rss-e140ce4f08e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/befbfb84f49c</guid>
            <category><![CDATA[network]]></category>
            <category><![CDATA[network-security]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Arunarka Mukhopadhyay]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 06:00:43 GMT</pubDate>
            <atom:updated>2023-10-08T06:00:43.762Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DDoS</strong>, or <strong>Distributed Denial of Service</strong>, is an infamous form of cyber-attack that aims to disrupt a network or service, rendering it unusable to its intended users. These attacks, though prevalent since the advent of the <strong>World Wide Web,</strong> have gained prominence in recent years, with numerous attacks affecting major and smaller online platforms. In this blog, we will delve into the working of DDoS attacks and explore how businesses can defend themselves from such threats.</p><h3>What is a DDoS Attack?</h3><p>In a DDoS attack, the attacker exploits multiple compromised systems to target a single system, causing a denial of service (DoS). These attacks tend to flood the targeted system with an overwhelming amount of traffic, effectively overloading its resources and causing it to crash or become unresponsive. These requests are superfluous and the attacker has no acceptable reason to make these requests other than malevolent intentions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*AzfOMV_e2B6_DMBPI53HnA.png" /><figcaption>Schematic diagram of DDoS attack(<a href="https://www.researchgate.net/figure/Schematic-diagram-of-a-DDoS-attack_fig1_365618619">https://www.researchgate.net/figure/Schematic-diagram-of-a-DDoS-attack_fig1_365618619</a>)</figcaption></figure><p><strong>There are different types of DDoS attacks:</strong></p><p>1. <strong><em>Volume-Based Attacks</em></strong>: The goal here is to douse the bandwidth of the targeted site. Examples include ICMP floods and UDP floods.<br>2. <strong><em>Protocol Attacks</em></strong>: These focus on exploiting server resources. Examples include SYN floods.<br>3. <strong><em>Application Layer Attacks</em></strong>: These target applications and are often the most subtle and potent. Examples include HTTP GET and POST attacks.</p><h3>The Motive Behind DDoS</h3><p><strong>Various motives which drive the modern DDoS attacks</strong>:</p><p>- <strong><em>Retaliation</em></strong>: Often perpetrated by hacktivist groups to send a political message.<br>- <strong><em>Business Competition</em></strong>: Rivals might use DDoS as a dirty tactic to harm a competing business.<br>- <strong><em>Extortion</em></strong>: Attackers demand money in exchange for halting the attack.<br>- <strong><em>Distraction</em></strong>: DDoS can be used to divert attention from another malicious activity taking place.</p><h3>The Defense Strategy</h3><p><strong>Protecting against DDoS attacks requires a multi-layered approach:</strong></p><p>1. <strong><em>Upstream traffic filtering</em></strong>: All traffic destined to the victim is pivoted to pass through a cleaning center via various methods such as: changing the victim IP address in the DNS system, tunneling methods, proxies, digital cross connects, or even direct circuits, which disjoints bad traffic and only sends legitimate traffic to the victim server.</p><p>2. <strong><em>Content Delivery Networks (CDN)</em></strong>: CDNs can mitigate DDoS attacks by distributing traffic across a vast network of servers.</p><p>3. <strong><em>Overprovisioning</em></strong>: Always keep more bandwidth than you need. This ensures that even during an attack, some portion of your legitimate traffic gets through.</p><p>4. <strong><em>DDoS Protection Services</em></strong>: These are specialized services that detect and mitigate large-scale DDoS attacks.</p><p>5. <strong><em>Redundancy</em></strong>: Have backup infrastructure in place. If one set of resources becomes overwhelmed, the traffic can be redirected to another.</p><p>6.<strong><em> Incident Response Plan</em></strong>: Always have a plan in place for when things go awry. This ensures a swift and coordinated response during an attack.</p><p>7. <strong><em>Educate and Train Your Team</em></strong>: A well-informed team can recognize early signs of an attack and act quickly to mitigate it.</p><h3>Conclusion</h3><p>The digital realm offers endless opportunities for growth and connectivity, but it also brings along a set of challenges. DDoS attacks, though formidable, can be managed and mitigated with a combination of technology, planning, and vigilance. As the cyber landscape evolves, it’s crucial for businesses to stay informed and proactive in their defensive measures.</p><p><strong>Further Reading and References</strong>:<br>1. <a href="https://owasp.org/www-community/attacks/Denial_of_Service">https://owasp.org/www-community/attacks/Denial_of_Service</a></p><p>2. <a href="https://en.wikipedia.org/wiki/Denial-of-service_attack">https://en.wikipedia.org/wiki/Denial-of-service_attack</a></p><p>3. <a href="https://www.researchgate.net/figure/Schematic-diagram-of-a-DDoS-attack_fig1_365618619">https://www.researchgate.net/figure/Schematic-diagram-of-a-DDoS-attack_fig1_365618619</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=befbfb84f49c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Defensive Programming]]></title>
            <link>https://medium.com/trademo-engg/the-art-of-defensive-programming-62c6f22b2758?source=rss-e140ce4f08e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/62c6f22b2758</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Arunarka Mukhopadhyay]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 13:55:50 GMT</pubDate>
            <atom:updated>2023-09-08T13:55:50.645Z</atom:updated>
            <content:encoded><![CDATA[<p>Programming, at its core, is about creating solutions that not only solve the task at hand but also stand the test of time, unpredictable user input, and unforeseen circumstances. Defensive programming is a coding practice where the developer anticipates possible problems before they occur, ensuring robustness and stability. This article delves into this art and illustrates ways to make your code more resilient and foolproof.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*hlHnCn2LcsQpyx5sx7AfaQ.jpeg" /></figure><h3>1. Anticipating Bad Input</h3><p>Regardless of how clear and comprehensive your user instructions are, you’ll always have instances where users enter unexpected or wrong data. Defensively written code must anticipate and handle these scenarios.</p><p>Tips for guarding against bad input:</p><ul><li>Input Validation: Every time you accept input from a user, validate it. This includes checking for null values, ensuring the correct data type, and verifying the data’s range.</li><li>Regular Expressions: Use regex to ensure that strings match a specific pattern, especially when dealing with emails, phone numbers, and passwords.</li><li>Whitelisting vs. Blacklisting: It’s easier and safer to specify what’s allowed (whitelisting) than to list all potential threats (blacklisting).</li></ul><h3>2. Graceful Failure</h3><p>Even the most diligently written programs can encounter unexpected issues. Defensive programming acknowledges this and ensures that when a failure occurs, it’s handled gracefully.</p><p>Guidelines for graceful failure:</p><ul><li>Exception Handling: Always have exception handlers to manage unexpected errors. This will allow the program to decide the next steps instead of just crashing.</li><li>Custom Error Messages: Offer user-friendly error messages that provide guidance on what went wrong and possibly how to correct it. Avoid exposing raw error messages that could reveal sensitive system information.</li><li>Fallback Procedures: For critical operations, have backup procedures in place. For example, if a database connection fails, you might queue the data for later processing or store it locally.</li></ul><h3>3. Code Robustness through Self-checks</h3><p>A defensively written program continually verifies its own health.</p><p>Implementing code self-checks:</p><ul><li>Assertions: Use assertions to validate the program’s state. They’re useful during development, making it clear when and where an assumption was violated.</li><li>Logging: Regularly log critical parts of your system. This way, if something goes wrong, you can trace back the events leading up to the failure.</li></ul><h3>4. Avoid Hard Crashes</h3><p>Crashing is a severe response to an error. Sometimes, it’s unavoidable, but your program should always attempt to handle the error and proceed or fail elegantly.</p><p>Strategies to prevent hard crashes:</p><ul><li>Timeouts: If your code calls external services or waits for resources, always use timeouts. This ensures your code doesn’t hang indefinitely.</li><li>Resource Existence Checks: Before accessing files, databases, or other resources, verify their existence and availability.</li><li>Memory Management: Keep a vigilant watch on memory usage, ensuring there are no memory leaks which can lead to system slowdowns or crashes over time.</li></ul><h3>5. Keep It Simple and Transparent</h3><p>Complexity is the enemy of defensive programming. The more complex your code, the harder it becomes to anticipate all possible issues.</p><ul><li>Code Reviews: Regularly review your code. Fresh eyes often spot potential problems that the original developer missed.</li><li>Documentation: Keep your codebase well-documented. Explain why certain defensive measures are in place. This makes it easier for other developers to maintain and expand upon your code.</li></ul><p>In conclusion, defensive programming is more than just a technique; it’s a mindset. By anticipating potential issues, validating input, ensuring graceful failures, and maintaining simplicity, you safeguard your application against numerous pitfalls. It might require more effort initially, but the stability, security, and robustness benefits it offers make it a practice every developer should embrace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62c6f22b2758" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trademo-engg/the-art-of-defensive-programming-62c6f22b2758">The Art of Defensive Programming</a> was originally published in <a href="https://medium.com/trademo-engg">Trademo-engg</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>