<?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: GoluScriptMage</title>
    <description>The latest articles on DEV Community by GoluScriptMage (@chitranshu_dhakad_132d9c0).</description>
    <link>https://dev.to/chitranshu_dhakad_132d9c0</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3742025%2F57b58894-24ba-4d5f-bc38-070545faf6f1.jpg</url>
      <title>DEV Community: GoluScriptMage</title>
      <link>https://dev.to/chitranshu_dhakad_132d9c0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chitranshu_dhakad_132d9c0"/>
    <language>en</language>
    <item>
      <title>🚀How Two Computers Create a Secret Without Ever Sharing It</title>
      <dc:creator>GoluScriptMage</dc:creator>
      <pubDate>Tue, 21 Jul 2026 11:36:40 +0000</pubDate>
      <link>https://dev.to/chitranshu_dhakad_132d9c0/how-the-legendary-problem-of-encryption-secrets-gets-shared-diffie-hellman-5fbf</link>
      <guid>https://dev.to/chitranshu_dhakad_132d9c0/how-the-legendary-problem-of-encryption-secrets-gets-shared-diffie-hellman-5fbf</guid>
      <description>&lt;p&gt;For quite a time, I was thinking: how does encryption really work?&lt;/p&gt;

&lt;p&gt;Like, if I want to send a secret request (like an auth token) to a server, but the network channel is insecure. Thousands of people can see what we are sending.&lt;/p&gt;

&lt;p&gt;We can't even share a secret password (key) to each other beforehand. Because if we send the password over the network, everyone else will see it and use it too.&lt;/p&gt;

&lt;p&gt;So how on earth do we connect securely?&lt;/p&gt;

&lt;p&gt;Then I researched and found out about the legendary minds who solved this. Let's break it down—this is going to be a fun topic.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎨 The Paint Color Analogy
&lt;/h2&gt;

&lt;p&gt;Imagine you and I want to agree on a secret color, but a spy is watching every single color we pass to each other.&lt;/p&gt;

&lt;p&gt;Here is the color theory trick:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Public Agreement:&lt;/strong&gt; We openly agree on a starting color, let's say &lt;strong&gt;Yellow&lt;/strong&gt;. The spy hears this.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Private Secrets:&lt;/strong&gt; I choose a secret color (&lt;strong&gt;Red&lt;/strong&gt;). You choose a secret color (&lt;strong&gt;Blue&lt;/strong&gt;). We keep these secret in our minds.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The Mix:&lt;/strong&gt; I mix my secret Red with the public Yellow to get &lt;strong&gt;Orange&lt;/strong&gt;. You mix your secret Blue with the public Yellow to get &lt;strong&gt;Green&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The Exchange:&lt;/strong&gt; We send our mixed colors (Orange and Green) to each other. The spy intercepts them. But the spy cannot easily separate the mixed colors to find our private Red or Blue.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;The Match:&lt;/strong&gt; I take your Green (Blue+Yellow) and add my secret Red to it. You take my Orange (Red+Yellow) and add your secret Blue to it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt; Both of us now have the exact same color mixture: &lt;strong&gt;Red + Blue + Yellow (Brown)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We just agreed on a shared secret color without ever sending our private secret colors over the network!&lt;/p&gt;




&lt;h2&gt;
  
  
  🗺️ The Connection Flow
&lt;/h2&gt;

&lt;p&gt;Here is the exact step-by-step lifecycle of how this handshake and data encryption works under the hood:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;================================================================================
PHASE 1: THE TLS HANDSHAKE (Color Exchange) - Tunnel Building
Goal: Agree on the "Brown Key" without hackers reading our private colors.
================================================================================

 GOLU (Browser)                                                 SIA (Web Server)
 [Private Color: RED]                                         [Private Color: BLUE]
          |                                                             |
          | ----- 1. ClientHello (Agree on public color: YELLOW) -----&amp;gt; |
          |                                                             |
          | &amp;lt;---- 2. ServerHello (Confirm public color: YELLOW) ------- |
          |                                                             |
          | 3. Golu mixes:                                              |
          |    RED + YELLOW = ORANGE                                    |
          |                                                             |
          | ----- 4. Golu sends mixed ORANGE -------------------------&amp;gt; |
          |                                                             |
          |                                           5. Sia mixes:     |
          |                                              BLUE + YELLOW = GREEN
          |                                                             |
          | &amp;lt;---- 6. Sia sends mixed GREEN ---------------------------- |
          |                                                             |
          | 7. Golu computes key:                                       |
          |    RED + GREEN (Sia's mix)                                  |
          |    = BROWN KEY                                              |
          |                                           8. Sia computes key:
          |                                              BLUE + ORANGE (Golu's mix)
          |                                              = BROWN KEY
          |                                                             |
================================================================================
RESULT: Both have the same "BROWN KEY". Secure tunnel is OPEN!
================================================================================

          |                                                             |
          |                                                             |

================================================================================
PHASE 2: SECURE APPLICATION SESSION (Sending the Auth Token)
Goal: Send the sensitive token encrypted so only Golu &amp;amp; Sia understand it.
================================================================================

 GOLU (Browser)                                                 SIA (Web Server)
 [Token: "XYZ"]                                               [Database Check]
          |                                                             |
          | 1. Encrypt with BROWN KEY:                                  |
          |    "XYZ" + BROWN = "x&amp;amp;9#p"                                  |
          |                                                             |
          | ----- 2. Sends Encrypted Request ("x&amp;amp;9#p") ---------------&amp;gt; |
          |                                                             |
          |                                           3. Decrypts with BROWN KEY:
          |                                              "x&amp;amp;9#p" + BROWN = "XYZ"
          |                                                             |
          |                                           4. Database Lookup:
          |                                              Is "XYZ" valid? YES!
          |                                                             |
          | &amp;lt;---- 5. Sends Encrypted Status ("Logged In") ------------- |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;In computers, we don't mix paint. We use a mathematical trick called &lt;strong&gt;Modulo Arithmetic&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Because finding the private key from the public key is mathematically impossible for computers in a reasonable timeframe (known as the &lt;strong&gt;Discrete Logarithm Problem&lt;/strong&gt;), the spy is completely locked out.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛡️ The Major Limitation: Man-in-the-Middle (MITM)
&lt;/h2&gt;

&lt;p&gt;While Diffie-Hellman is legendary, it has one critical vulnerability: &lt;strong&gt;It does not verify identity.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a hacker sits in the middle of our connection, they can intercept Golu's public key, establish a secure tunnel with Golu pretending to be Sia, and establish another secure tunnel with Sia pretending to be Golu. &lt;/p&gt;

&lt;p&gt;This is the &lt;strong&gt;Man-in-the-Middle (MITM) attack&lt;/strong&gt;. Diffie-Hellman encrypts the traffic, but it doesn't prove &lt;em&gt;who&lt;/em&gt; you are talking to. &lt;/p&gt;

&lt;p&gt;To solve this, modern HTTPS combines Diffie-Hellman with &lt;strong&gt;Digital Certificates (SSL)&lt;/strong&gt;. The server must provide a cryptographic certificate signed by a trusted authority to prove that "Sia" is actually Sia, not a hacker in the middle.&lt;/p&gt;




&lt;p&gt;💬 &lt;strong&gt;What is the single systems concept that blew your mind when you first learned it? Let me know in the comments!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you liked this simple breakdown, follow me for more interesting systems engineering topics.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;Golu&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>backend</category>
      <category>networking</category>
      <category>cryptography</category>
    </item>
    <item>
      <title>📝 Error Never Lies: A Systems Programmer's Guide to Truth</title>
      <dc:creator>GoluScriptMage</dc:creator>
      <pubDate>Mon, 20 Jul 2026 12:19:08 +0000</pubDate>
      <link>https://dev.to/chitranshu_dhakad_132d9c0/error-never-lies-a-systems-programmers-guide-to-truth-fpi</link>
      <guid>https://dev.to/chitranshu_dhakad_132d9c0/error-never-lies-a-systems-programmers-guide-to-truth-fpi</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"My code is correct, but it's not working."&lt;/strong&gt; &lt;br&gt;
If you have ever said this, you have told the single biggest lie in software engineering.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ⚡ The Illusion
&lt;/h2&gt;

&lt;p&gt;We have all been there. You look at a block of TypeScript code, check it with your eyes, and swear to the coding gods that the logic is flawless without any problems. Yet, the terminal is telling the error line, or the process is hanging indefinitely, mocking you.&lt;/p&gt;

&lt;p&gt;Your brain goes through the five stages of debugging grief:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Denial:&lt;/strong&gt; &lt;em&gt;"This is impossible. The code is literally perfect."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anger:&lt;/strong&gt; &lt;em&gt;"Express/Node/Git is broken. It's a bug in the runtime."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bargaining:&lt;/strong&gt; &lt;em&gt;"Maybe if I restart the server, it will fix by itself."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Depression:&lt;/strong&gt; &lt;em&gt;"I don't know what I'm doing. I should just choose a different career."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Acceptance:&lt;/strong&gt; &lt;em&gt;Looking at the error trace.&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the cold, hard systems reality: &lt;strong&gt;The computer is a machine of pure logic. It does not have an ego, it does not have fatigue, and it does not make random assumptions. It executes exactly what you wrote, not what you intended to write.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔎 Case Study: The Double Response Kalesh(fight)
&lt;/h2&gt;

&lt;p&gt;Let's look at a classic real-world bug that drove me crazy for 20 minutes today.&lt;/p&gt;

&lt;p&gt;I was building a deployment reverse proxy engine. When deploying a project, the client CLI kept hanging on the fetch call. The server terminal was spitting out a massive traceback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:642:11)
    ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I checked my route handler. I checked my &lt;code&gt;if&lt;/code&gt; blocks. I was returning the response. I was sure.&lt;/p&gt;

&lt;p&gt;But the error trace pointed to a single line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subDomain&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The epiphany:&lt;/strong&gt; I had chained &lt;code&gt;.json()&lt;/code&gt; onto &lt;code&gt;.send(200)&lt;/code&gt;. In Express, &lt;code&gt;.send()&lt;/code&gt; instantly finishes the response cycle and flushes the headers to the client. The subsequent &lt;code&gt;.json()&lt;/code&gt; call tries to send data again over a closed channel.&lt;/p&gt;

&lt;p&gt;I was looking for complex logical bugs, but the error traceback was pointing directly at the boundary. It wasn't lying. I was.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏆 The Rules of the Debugging Arena
&lt;/h2&gt;

&lt;p&gt;If you want to survive the systems grind, you must live by these three rules:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Trust the Trace over your Eyes
&lt;/h3&gt;

&lt;p&gt;Your eyes read what your brain wants to see (the intended logic). The stack trace reads what the CPU actually executed. &lt;code&gt;Never skip reading the traceback&lt;/code&gt;. The file path and line number in the logs are the exact coordinate of your mistake.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Audit the Boundaries (I/O)
&lt;/h3&gt;

&lt;p&gt;Most bugs happen at interface boundaries—where the client talks to the server, where the code reads the filesystem, or where arguments are passed to a git command. If your client is expecting an array and you wrap it in an object, the system will crash. Check the data shape at the borders.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Savour the Error
&lt;/h3&gt;

&lt;p&gt;A clean terminal that hides silent failures is a time-bomb. A red error stack is a roadmap. It is telling you exactly where the system is weak. Every error you debug is a micro-lesson that hardens your systems knowledge.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏁 Outro
&lt;/h2&gt;

&lt;p&gt;The next time a terminal prints a massive traceback, don't get frustrated. Don't close the terminal. &lt;/p&gt;

&lt;p&gt;Take a deep breath, wash your hands in cold water, and read the trace line by line.&lt;/p&gt;

&lt;p&gt;Because the compiler doesn't hate you. And the &lt;strong&gt;Error never lies.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;💬 &lt;strong&gt;What is the single dumbest debugging mistake that cost you hours? Let me know in the comments!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you liked this post, follow for more deep-dives into backend systems and DevOps pipelines.&lt;/p&gt;

&lt;p&gt;— &lt;strong&gt;Golu&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
