<?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: Anirudh Kannan</title>
    <description>The latest articles on DEV Community by Anirudh Kannan (@crimsonbolt47).</description>
    <link>https://dev.to/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>DEV Community: Anirudh Kannan</title>
      <link>https://dev.to/crimsonbolt47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crimsonbolt47"/>
    <language>en</language>
    <item>
      <title>Backend Fundamentals</title>
      <dc:creator>Anirudh Kannan</dc:creator>
      <pubDate>Wed, 01 Apr 2026 17:50:45 +0000</pubDate>
      <link>https://dev.to/crimsonbolt47/backend-fundamentals-38l9</link>
      <guid>https://dev.to/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://dev.to/crimsonbolt47/part-2-dsa-in-rust-string-g11</link>
      <guid>https://dev.to/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://dev.to/crimsonbolt47/part-1-dsa-in-rust-intro-d58</link>
      <guid>https://dev.to/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://dev.to/crimsonbolt47/rsa-algorithm-4a6d</link>
      <guid>https://dev.to/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>
