<?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>Forem: Anirudh Kannan</title>
    <description>The latest articles on Forem by Anirudh Kannan (@crimsonbolt47).</description>
    <link>https://forem.com/crimsonbolt47</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%2F3674205%2Fa8688a16-ee4e-446c-82e6-fbf565002a5d.png</url>
      <title>Forem: Anirudh Kannan</title>
      <link>https://forem.com/crimsonbolt47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/crimsonbolt47"/>
    <language>en</language>
    <item>
      <title>What is VPN?</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Mon, 06 Apr 2026 05:11:59 +0000</pubDate>
      <link>https://forem.com/crimsonbolt47/what-is-vpn-4i43</link>
      <guid>https://forem.com/crimsonbolt47/what-is-vpn-4i43</guid>
      <description>&lt;p&gt;Now simple definition would be VPN is Virtual Private Network, but what does that mean?&lt;br&gt;
basically it allows a user to browser the internet a bit more safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;So VPN allows user to access contents of say a website they don't have access to or if you don't trust the internet itself it helps you to browser the internet without giving away your IP address&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Now assume you want to search a website called &lt;code&gt;us_only_website.com&lt;/code&gt;.&lt;br&gt;
now if you try to search it then you will not be able to view it cause its a US only website. only a user in US can access it.&lt;br&gt;
So your website query goes to the nearest ISP and sees your IP(192.168.x.x) is trying to call website us_only_website.com, it goes to the us_only_website.com and see it comes from some other country so it rejects it.&lt;/p&gt;

&lt;p&gt;Now lets use our VPN app for this.&lt;br&gt;
Now when you download a VPN you can set its location, lets say we set it to US.&lt;br&gt;
now here is what happens,&lt;br&gt;
we search us_only_website.com, now before it goes to the local ISP, first it goes to the VPN client app, now this app encrypts your query and everything and sends this to their VPN server in US.&lt;br&gt;
so now your IP address with your encrypted data goes to your local ISP and sees you are trying to make a request to say My_VPN.com and it to points you to that direction and you reach that server, now when you reach the server, &lt;br&gt;
it decrypts your data and sees you want to access us_only_website.com, so the server makes the request behalf of you and goes to us_only_website.com and see that request comes from us only so it gives you its resources like html css and all those other image etc. resources and sends it back to you encrypted so ISP again see the response from VPN server back to your IP address and it is received by your VON client which then decrypts your data and lets you see the content of us_only_website.com&lt;/p&gt;

&lt;p&gt;Now that is why people suggest you browse the internet using a VPN cause you cant trust the general internet and can see what you are doing, VPN prevents that.&lt;/p&gt;

&lt;p&gt;But in the end the request is received by your VPN server so they can see.&lt;/p&gt;

&lt;p&gt;So please don't use any shady VPN cause if your reason is to browse the internet safely then your entire purpose is defeated.&lt;br&gt;
OK also if you are in a private institution then even though they cant see what you are searching but they can can this IP address is making a request to a VPN server.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>networking</category>
      <category>privacy</category>
      <category>security</category>
    </item>
    <item>
      <title>Backend Fundamentals</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Wed, 01 Apr 2026 17:50:45 +0000</pubDate>
      <link>https://forem.com/crimsonbolt47/backend-fundamentals-38l9</link>
      <guid>https://forem.com/crimsonbolt47/backend-fundamentals-38l9</guid>
      <description>&lt;p&gt;So i want to keep this as a personal log and also anyone who wants to learn more or just want to fill some gaps.&lt;br&gt;
So this will be a bit unconventional but i will be keeping the order not so in terms of a junior dev, but rather in terms of difficulty.&lt;br&gt;
So these are the topics i hopefully will be talking about(in case i forgot or get back to my lazy ways)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Authentication and Authorization&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Networking&lt;/li&gt;
&lt;li&gt;Concurrency&lt;/li&gt;
&lt;li&gt;Observability&lt;/li&gt;
&lt;li&gt;API Design&lt;/li&gt;
&lt;li&gt;Deployment&lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;li&gt;Data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Or if you want you can go in order of 9-6-8-3-1-2-4-5-7.&lt;br&gt;
its up to you.&lt;/p&gt;

&lt;p&gt;So lets get started&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>backend</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Part-2: DSA in Rust-String</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Wed, 31 Dec 2025 14:37:20 +0000</pubDate>
      <link>https://forem.com/crimsonbolt47/part-2-dsa-in-rust-string-g11</link>
      <guid>https://forem.com/crimsonbolt47/part-2-dsa-in-rust-string-g11</guid>
      <description>&lt;p&gt;string intro&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Part 1: DSA in Rust-Intro</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Wed, 31 Dec 2025 14:36:41 +0000</pubDate>
      <link>https://forem.com/crimsonbolt47/part-1-dsa-in-rust-intro-d58</link>
      <guid>https://forem.com/crimsonbolt47/part-1-dsa-in-rust-intro-d58</guid>
      <description>&lt;h2&gt;
  
  
  &lt;u&gt;Introduction&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;So this series is about doing DSA in rust.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;so it wont explore the DSA concepts but more like how you can use rust to solve them, so its better to have learned your DSA concepts already&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;remember DSA isn't about the syntax of a language but the logic and reasoning you need to solve a problem&lt;br&gt;
but then it is also good to learn a new languages and make you comfortable in it.&lt;/p&gt;

&lt;h3&gt;
  
  
  So lets get started!!
&lt;/h3&gt;

&lt;p&gt;Topic i will be covering are:-&lt;/p&gt;

</description>
    </item>
    <item>
      <title>RSA Algorithm</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Tue, 23 Dec 2025 20:46:26 +0000</pubDate>
      <link>https://forem.com/crimsonbolt47/rsa-algorithm-4a6d</link>
      <guid>https://forem.com/crimsonbolt47/rsa-algorithm-4a6d</guid>
      <description>&lt;p&gt;So after a long time of scratching my head to learn RSA algorithm, i have finally figured it out!!.&lt;/p&gt;

&lt;p&gt;all thanks to this youtube video: &lt;a href="https://www.youtube.com/watch?v=D_PfV_IcUdA" rel="noopener noreferrer"&gt;NeuralNine Channel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So how how does RSA alogrithm work?&lt;br&gt;
So basically you have:&lt;br&gt;
Public Key &lt;br&gt;
Private Key &lt;br&gt;
where public key is used for encryption ad private key is used for decryption(cause it doesnt matter if some guy takes your public key and encrypts a message)&lt;/p&gt;

&lt;p&gt;So lets take an example of Alice and Bob(Generic but sure):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqyhcmu7qo8caf56ukjwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqyhcmu7qo8caf56ukjwi.png" alt=" " width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So Alice has a message that she wants to send to Bob,(But Alice doesn't want anyone else to see)&lt;br&gt;
So what she does is take the public key of Bob(cause anyone can access public key of anyone) and encrypts it and sends the Encrypted Message to Bob&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flv5p6pj8qluv8cd9mcr7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flv5p6pj8qluv8cd9mcr7.png" alt=" " width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then Bob gets the crypted message and decrypted it using his private key B and then gets the message&lt;/p&gt;

&lt;p&gt;but now the question becomes how does this witch craft even work??&lt;/p&gt;

&lt;p&gt;So this is how it works&lt;/p&gt;
&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;So you need is-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;p - a random prime number #1&lt;/li&gt;
&lt;li&gt;q - a random prime number #2&lt;/li&gt;
&lt;li&gt;n - product of p and q (p.q)&lt;/li&gt;
&lt;li&gt;O(n) - eulars totient value of n( cant even pronounce this but it is simple)&lt;/li&gt;
&lt;li&gt;e - public key(sort of)&lt;/li&gt;
&lt;li&gt;d - private key(sort of)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So with all that ingredients you get&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;public Key -(e,n) - used for encryption&lt;/li&gt;
&lt;li&gt;private Key - (d,n) - used for decrytpion&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note - when we say 'e' is public key is true but when we need to encrypt something we also need n, therefore public key that we usually have is zipped version of (e,n) to base 64. that is same for private key too, but private key is zipped as (d,n,p,q,dp,dq,qinv) which i will explain it later on so dont worry about that) &lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Prerequistes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;co-prime
2 number a and b are co-prime if gcd(a,b) = 1
which essentially means there is no number that can divide a and b to get a integer value which is not 1.&lt;/li&gt;
&lt;li&gt;mod
mod essentially means reminder
so 
A ≡ r mod B
means A/B =&amp;gt;  A = B*m + r
your simple division rule
interesting stuff
(A-r) = B*m
so, (A-r) ≡ modB&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Step-1 Get the prime numbers
&lt;/h2&gt;

&lt;p&gt;so first thing we need is 2 prime numbers p and q.&lt;br&gt;
now they are generated randomly using some algorithms similiar to random number generator but they are usually &lt;strong&gt;very large!!&lt;/strong&gt;&lt;br&gt;
but for our example we will take:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p = 11
q = 13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step-2 Find n - product of those 2 prime number
&lt;/h2&gt;

&lt;p&gt;this is very simple just multiply those 2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n = p.q
  = 11.13
  = 143
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;therefore n = 143&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-3 find O(n) ( this part is actually simple than it sounds)
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Note O(n) is not represented by 'O' its represented by epsilon but i cant find it in my keyboard&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Definition&lt;/strong&gt;-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    O(x) =&amp;gt; number of values from [1,x-1] that are co-prime
ex: O(8) =&amp;gt; 1, 3, 5, 7
    therefore O(8) = 4 ( 4 prime numbers)

&amp;gt;Note- O(x) = x-1                       if x is prime(think about it)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;therefore, O(n) = O(143)
                = O(n)
                = O(p*q)
                = O(p) * O(q)
                = (p-1) * (q-1)                       ,by our rule
                = 10 * 12
                = 120
therefore O(n) = 120
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step-4 Picking public key (e)
&lt;/h2&gt;

&lt;p&gt;Logic: e should be 2&amp;lt;e&amp;lt;O(n) where e and O(n) are co-prime&lt;br&gt;
So we pick &lt;code&gt;e = 7&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: e could have been any co-prime number below O(n), for O(120) there are possible 32 possibilities but we just picked 7 cause its a cool number!!  (you could also pick 11 or even 13 cause logic wise this is also true)&lt;/p&gt;

&lt;p&gt;Note: in my mind i though it could be any prime number when i realize 5 even tho is a prime will not work here gcd(120, 5) = 5 they are not co-prime!!   ( this really solved my understanding of co-primes)&lt;/p&gt;

&lt;p&gt;Note: usually in real cases when p and q are very very large, e is picked as e = 65537 ( reason, i have no idea)   &lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Step- 5 finding private key (d)
&lt;/h2&gt;

&lt;p&gt;Logic=&amp;gt; should satisfy this condition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;e.d ≡ 1 mod O(n)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so how can we solve that&lt;br&gt;
Option #1 brute force(easiest but too slow for real cases)&lt;br&gt;
  try all the possibities and check the condition&lt;br&gt;
Option #2 Extended Euclidean Algorithm&lt;/p&gt;
&lt;h2&gt;
  
  
  Extended Euclidean Algorithm
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what we have, 
                e.d ≡ 1 mod O(n)
     what we know already, 
                          e and O(n) are co-prime
     therefore,
                  e*x + O(n)*y = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;where x is considered inverse modulo of e (which i will explain why)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;also back to,             e.d ≡ 1 mod O(n)
can be also written as    **(e*d) - 1** is divisible by O(n)

So,                    e*d - 1 = k* O(n)       where k is some number( its quotent btw)
     exchanging LHS and RHS we get,
                      e*d - k* O(n) = 1

                      e*d + (-k)* O(n) = 1
           compare with e*x + O(n)*y = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;d is inverse modulo of e&lt;br&gt;&lt;br&gt;
So why that matters??&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Lets use,      GCD( O(n) , e) = 1
               GCD( 120, 7) = 1
        now it can be re-written as,

                    |
            120 = 7*17 + 1                     (7 is e and 1 is rem)

              1 = 120 - 7*17
              1 = 7*(-17) + 1* 120
compare to,   1 = e* d    + k *O(n)

d = -17 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: now technically private key is -17, it must be a positive number so to get the positive number we do inverse of d&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;d ≡ (-17) mod (120)&lt;/code&gt;                  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;because A ≡ r mod B also be written as r ≡ A mod B&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-17 ≡ d^-1 mod (120)

-17 ≡ (103) mod (120)                 ,with a bit of calculation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;therefore d = 103 &lt;/p&gt;

&lt;h2&gt;
  
  
  Step- 6 Final Result
&lt;/h2&gt;

&lt;p&gt;we get&lt;br&gt;
 public key = (e,n)&lt;br&gt;
 private key = (d,n)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Now public key (e,n) means we get a public key by taking e and n and zipping it(where we get it in base64 which is like ac32d983a or something like that). so for calculation like encrpyting it we unzip the public key and get the original e and n for encryption calculation&lt;/p&gt;

&lt;p&gt;Note: private Key is can be (d,n) but now a days it is also zipped with (d, n, p, q, dp, dq, qinv) where those extra values make the decryption faster , like x4 times faster!!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  So back to the example
&lt;/h2&gt;

&lt;p&gt;Alice wants to send message to Bob&lt;br&gt;
assume message = 15                               (ya a very secret message)&lt;/p&gt;

&lt;p&gt;so how it is encrypted is we take public key of B(a35cd694dcd9422 or something) &lt;br&gt;
and unzip it to get our original e = 7 and n = 143&lt;br&gt;
so we do,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Cipher = message ^ e mod n          (this is why we need both e and n)
               = 15^7 mod 143
               = 115
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now this cypher text is taken by Bob who decrypts it with his private key (d,n)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; Message = cipher ^ d mod n
              = 115 ^ 103 mod 143
              = 15 !!!!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we finally did it !!!&lt;/p&gt;

</description>
      <category>cryptography</category>
    </item>
  </channel>
</rss>
