<?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 Beqa on Medium]]></title>
        <description><![CDATA[Stories by Beqa on Medium]]></description>
        <link>https://medium.com/@beqa3352?source=rss-8055d81fd0fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gPo_u65kLeJbYWnY</url>
            <title>Stories by Beqa on Medium</title>
            <link>https://medium.com/@beqa3352?source=rss-8055d81fd0fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:42:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@beqa3352/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[What the hell is a Context Switch?]]></title>
            <link>https://medium.com/@beqa3352/what-the-hell-is-a-context-switch-b5e6e6002512?source=rss-8055d81fd0fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5e6e6002512</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[cpu]]></category>
            <category><![CDATA[context-switching]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cores]]></category>
            <dc:creator><![CDATA[Beqa]]></dc:creator>
            <pubDate>Sun, 16 Nov 2025 16:34:09 GMT</pubDate>
            <atom:updated>2025-11-16T16:34:09.923Z</atom:updated>
            <content:encoded><![CDATA[<p>The hidden tax your CPU pays to multitask</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*epRxowUgpDwDul8_.png" /></figure><blockquote>Before we dive into the idea of context switching, we need to understand a few basics:</blockquote><ol><li><strong><em>Process</em></strong> — program that is running in its own memory space, usually not interacting with other processes. Chrome and Spotify are processes.</li><li><strong><em>Thread</em></strong> — unit in a process, threads from the same process share the same memory space, so sharing their data is simple. a bug in one thread can potentially crash the whole process. Each chrome tab can be thought of as a separate thread within the Chrome process.</li></ol><h4>Now let’s explain what exactly is a context switching:</h4><p>When you open an app like Google Chrome on your laptop, the Chrome process starts running on the CPU. All of its memory, requests and tasks need the processor to handle them. The CPU is constantly checking in to update memory, render the view and respond to user actions.</p><p>Now imagine you also open Spotify to play some music. Your computer still has only one CPU (ignoring multi-core for now), but now there are <strong>two </strong>processes competing for its attention. The CPU can’t literally do both at the exact same time, so it rapidly switches between them, saving the state of one process and loading the state of the other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*flGhtvj3OuAeD23C.gif" /></figure><p>This rapid switching happens so fast that it creates the illusion that all<strong> </strong>apps are running simultaneously, even though the CPU is only working on one task at any given moment. This switching of CPU attention from one process (or thread) to another is what we call <strong>context switching</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2PWtqxHniHH9vn65.jpg" /><figcaption>Context switching is like juggling, balls keep moving between hands but If you pause the process, the juggler is holding just one ball at any given moment.</figcaption></figure><blockquote>Why can’t the CPU run more than one process</blockquote><blockquote>at the exact same time?</blockquote><p>Actually, it can, <strong>if it has multiple cores</strong>. On a single-core CPU, there’s only one execution context, which means the core can handle only one operation at any given moment (the gif above). It’s like a barista with five customers: the orders stack up, but at any instant the barista is working on exactly one drink, then switching to the next, then maybe back to the first to finish it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pU1Po4XeCQPjSjKvQkXkuA.png" /><figcaption>Single-core CPU runs one thread, quad-core (4 cores) runs four simultaneously</figcaption></figure><p>A single-core CPU is like a barista, he’s lucky if there’s only one customer at a time. With two customers, the barista can either finish the first drink and then start the second, or keep switching between the two, making progress on both at once , <strong>that’s context switching</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*al-0C6HLYSMf6aRt.jpg" /></figure><p>But if the customers keep adding up, let’s say 10, 20, or 30, one barista simply can’t handle them all, even if he switches between drinks very fast. Some customers would have to wait a long time for their drinks. The solution is to <strong>add more baristas</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*AE5IJry_YKoqM6shZw2m_A.png" /><figcaption>I hate using AI pictures but couldn’t find the perfect one on the internet</figcaption></figure><p>Now they all can handle 4 customers at the same time. When 1 barista would be switching between 4 drinks back and forth, wasting time between switches, 4 baristas don’t need to do that, they can focus on one customer only.</p><p>What happens if 4 more customers come into the bar? That’s not a problem, Now a single barista will serve 2 customers, only switching between making 2 drinks, which is far better than a single barista making 8 drinks at the same time, right?</p><p>Similarly, when one CPU core can’t handle all the processes anymore, we <strong>add more cores</strong> to the CPU!</p><p><em>here’s the visual representation:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UYZtp-JivDfBl1Ty.gif" /></figure><p>So now we understand the concept of context switching in more detail. It’s not a hard concept at all, it’s just the CPU trying not to freeze your youtube video while you open a calculator app. It’s trying to handle everything fairly at the same time and create the illusion that all the processes are running simultaneously.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5e6e6002512" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between RAM and Disk]]></title>
            <link>https://medium.com/@beqa3352/difference-between-ram-and-disk-c541e635d757?source=rss-8055d81fd0fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c541e635d757</guid>
            <category><![CDATA[ssd]]></category>
            <category><![CDATA[disk]]></category>
            <category><![CDATA[hdd]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[random-access-memories]]></category>
            <dc:creator><![CDATA[Beqa]]></dc:creator>
            <pubDate>Sun, 30 Mar 2025 11:37:15 GMT</pubDate>
            <atom:updated>2025-03-30T11:37:15.049Z</atom:updated>
            <content:encoded><![CDATA[<p>Both RAM and disk store data, so why isn’t just one enough?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoImJLkiHxvAaCZo9alOig.png" /></figure><p>A computer, like a human, has both long-term and short-term memory. We rely on short-term memory for everyday tasks — remembering coworker’s name, listening to respond in a conversation, or counting change from a cashier to ensure it’s correct.</p><p>But we can’t rely only on short-term memory. If someone asks you about something you don’t use every day — like the plot of your favorite movie or the ending of a book you read a year ago — you need time to think about it and search it in your mind. So responding to a conversation is much quicker and easier than remembering something you haven’t thought about in a while, Computer memory works in a similar way.</p><p>A computer uses long-term memory (the disk) to store data that isn’t needed right away, like files, music, and pictures. This data doesn’t need to be accessed super quickly because it’s not essential for running programs or performing tasks in real-time. As a result, it’s okay if it takes a little longer to retrieve.</p><p>But what about the data we need right now to make programs run smoothly, like when you’re browsing the web, where your browser needs to load pages, images, and videos?</p><p>Great question! (Even though I’m the one asking it)</p><p>That’s where <strong>RAM</strong> comes in. Think of it like the computer’s short-term memory. It’s fast but limited. When you open a website, play a game, or write in a document, the computer uses RAM to store required data while you’re working with it. But when you turn off the computer, everything in RAM disappears — kind of like how you forget what you had for lunch 2 days ago.</p><p>You might think, “<strong><em>Why not just put all the memory in RAM so everything runs super fast?</em></strong>” The problem isn’t just that <strong>RAM is expensive</strong>, but that RAM is designed to only hold the data we need right now. Imagine if you had to remember every single detail of your life all at once — it would be overwhelming! You wouldn’t be able to focus on what’s happening in the moment because you’d be too busy managing tons of information. RAM works the same way: it keeps only the data we need right now, focus and function efficiently, without being bogged down by everything else because after all it has limited space.</p><p>Another issue with storing everything in RAM is that if the computer turns off, all the data in RAM is erased. This is actually what makes RAM so fast — it doesn’t need to write data to a long-term memory disk, which takes time. It’s like when someone tells you their phone number, you can remember it quickly in the moment if you actively repeat it in your mind, but if you don’t write it down, you’ll probably forget it after a few hours or days. RAM works the same way: it holds data temporarily, and once the power is off, everything disappears.</p><p>You may also ask, “<em>Storing data in RAM also takes time, so why don’t we just store everything on a disk from the start? What makes storing data in RAM faster than on a disk?</em>”</p><p>The answer is simple: <strong>Physical design!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/0*U31XbD-kYZ0cYB2b.jpg" /><figcaption>Random Access Memory (RAM)</figcaption></figure><p>RAM is built to be super fast, it uses electrical charges to store data in memory cells. These cells are incredibly quick to read from and write to, but they need a constant flow of electricity to maintain the data. Once the power goes off, the electrical charges fade away, and the data is lost. This is why it’s called <strong>volatile memory</strong> — the data is there only as long as the system is powered on.</p><p>On the other hand, <strong>nonvolatile</strong> memory (like HDDs or SSDs) stores data in a more stable, long-lasting way. They don’t rely on constant power to keep the data intact, so even when the power is turned off, the data remains.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olgHmIUXiov8B-wsGrJmpg.jpeg" /><figcaption>Semiconductor chip on RAM (couldn’t find really detailed picture so I made this with AI)</figcaption></figure><p>In a more technical language <strong>RAM</strong> is built using <strong>semiconductor chips </strong>which are designed for <strong>rapid access</strong>. These chips can read and write data almost instantly, in <strong>nanoseconds</strong> (billionths of a second). The data is stored as <strong>electrical charges</strong>, which are easy to manipulate quickly.</p><p><strong>Disks</strong>, on the other hand, work differently. <strong>HDDs</strong> rely on <strong>spinning platters</strong> and <strong>read/write heads</strong> that physically move to access the data. This mechanical movement takes time, which makes <strong>HDDs much slower</strong> than RAM. <strong>SSDs</strong> are faster than HDDs because they use <strong>flash memory</strong>, which stores data by moving <strong>electrons</strong> between transistors. While flash memory is much quicker than mechanical HDDs, it’s still <strong>slower than RAM</strong> due to the extra time needed to move those electrons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*usnV8qnBE6lk3xF0.gif" /><figcaption>An HDD stores data on spinning magnetic platters, where read/write heads move across the surface to access or modify the data.</figcaption></figure><p>So, the trade-off is between speed and long-term storage: RAM is designed for fast data retrieval, but it can only hold data temporarily, while disks are slower but can store data for as long as you need it.</p><p>Now you know why adding more RAM to your computer doesn’t automatically make it better. RAM helps with multitasking, but the disk is still needed to store important data and access it when required. When it comes to computer speed, the processor (CPU) is the real factor that determines how quickly tasks are completed. If your CPU is slow, adding more RAM won’t make much of a difference. More RAM simply ensures your system doesn’t run out of memory during heavy workloads. The CPU, however, is a whole new topic and deserves its own article. So, if you enjoy my way of explaining things, let me know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c541e635d757" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What the hell is a Garbage Collector?]]></title>
            <link>https://medium.com/@beqa3352/what-the-hell-is-a-garbage-collector-71ce1fbbde94?source=rss-8055d81fd0fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/71ce1fbbde94</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[garbage-collection]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Beqa]]></dc:creator>
            <pubDate>Sun, 16 Jun 2024 16:12:31 GMT</pubDate>
            <atom:updated>2024-06-16T16:12:31.287Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, let’s dive into a concept that many developers might not be familiar with - <strong>garbage collection</strong> in programming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4kYJ5wt80T02tLpT.jpeg" /></figure><p>In the early days of programming, memory management was a manual task. Programmers had to ensure efficient use of memory by allocating and deallocating it as needed, making sure none of it was wasted.</p><p>As you can guess, this process was prone to errors, leading to common problems such as:</p><ol><li><strong>memory leaks — </strong>memory that is no longer needed but still holds some data.</li><li><strong>dangling pointers — </strong>a pointer that still points to data even though that data has been deleted or is no longer valid.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*MAi0UqFTJCbGODhP.png" /><figcaption>d here is a dangling pointer as it points to some deleted object</figcaption></figure><p>How can we solve this problem? How can we make sure that memory is managed efficiently without manually allocating everything in our code, while also avoiding errors like memory leaks or dangling pointers?</p><p>To answer this question, let’s imagine we’re going to McDonald’s together!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ForI8ZWfx7LjoSMj.jpg" /><figcaption>spent half an hour searching for a good pic</figcaption></figure><p>We’re eating our McBurgers or whatever (I don’t go there). After finishing, we need to take our plates and throw all the leftovers in the trash, right? But what happens if we forget to do that, or if there are still some things left on the table? The staff members take care of it. They collect all the leftover items and throw them into the trash.</p><p><strong>A garbage collector </strong>works in a similar way. Even if we forget to allocate or deallocate memory correctly, the garbage collector automatically manages these tasks.</p><h3>Does the garbage collector run at specific times or continuously?</h3><p>Garbage collector typically runs when certain conditions are met, such as when memory allocation reaches a certain predefined limit or when a specific amount of time has passed since the last garbage collection cycle. This approach balances between <strong>responsiveness</strong> (how quickly the program can respond to user input or other events) and <strong>overhead </strong>(additional CPU time and memory used by the garbage collection process).</p><h3>Why don’t all languages use a garbage collector then?</h3><p>You might wonder: if garbage collection is so beneficial and simplifies our work, why isn’t it universally adopted? The main reason is <strong>performance</strong>.</p><p>Garbage collection involves periodic pauses in the program to reclaim unused memory. These pauses, known as <strong>garbage collection pauses</strong>, can impact the responsiveness and real-time performance of applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*XaefDth2AvpEXMZ-.png" /></figure><blockquote>this illustration shows a thread that triggers a garbage collection and causes the other threads to be suspended</blockquote><p>That’s one reason why languages with garbage collection, like <strong>Python</strong> and <strong>JavaScript</strong>, are often slower compared to languages requiring manual memory management, such as <strong>C++</strong> and <strong>Rust</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r2PHtaWU7GMpQTx1" /><figcaption>the same algorithm solved in python and c++, look at their runtimes!</figcaption></figure><p>So, as we learned today, a garbage collector is like a cleanup crew for a computer’s memory. It automatically finds and removes unused or unnecessary data (garbage) to free up memory space. This helps programmers avoid manually managing memory, reducing errors and making software easier to develop.</p><p>Shout out to all the random computer geeks whose answers from 10 year old forum posts helped me write this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71ce1fbbde94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why are strings immutable in Python?]]></title>
            <link>https://medium.com/@beqa3352/why-are-strings-immutable-in-python-29e07c7fa64b?source=rss-8055d81fd0fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/29e07c7fa64b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[string]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[string-interning]]></category>
            <category><![CDATA[string-pool]]></category>
            <dc:creator><![CDATA[Beqa]]></dc:creator>
            <pubDate>Thu, 16 May 2024 11:52:29 GMT</pubDate>
            <atom:updated>2024-05-16T12:19:30.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CrSqyl-ys7nF4x0_jgo-g.png" /></figure><p>If you’re learning <strong>Python </strong>(or Java, or JavaScript), you might wonder why we can’t change strings once we create them, unlike arrays or objects. By “changing,” I mean altering the existing value, not reassigning it to a new value, which is perfectly fine.</p><blockquote>The reason behind this is something called “String interning” (“String pool” in Java).</blockquote><blockquote>Now, lets dive into how it works! once again, turn on your imagination and follow me.</blockquote><p>Imagine you’re a teacher on your first day of class. The kids are greeting you and asking for your name. After you write your name on the board, it’s their turn to share theirs. So, one by one, they go to the board and write their names. But soon, you notice that the board is filled with names, and many of them are the same — “George,” “Lisa,” and so on. It’s taking up a lot of space!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjI_3lSMaL-LySB8vcLs0A.png" /></figure><p>You start thinking of a better way to handle this, one that saves space on the board while still allowing all the kids to share their names. Here’s your idea: each kid goes to the board and writes their name. For example, George writes his name. The next student does the same, but if their name is also George, they just make a circle around the existing name. If their name is different, they write it down like George did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wbtgq3-dfNaIKR2Mt6IO3A.png" /></figure><p>So in the end, you got all the names and saved a lot of space by not writing the same thing over and over again. That’s how <strong>string interning</strong> works!</p><p>Whenever you create a string variable, the value goes into a place in memory called the <strong>String Constant Pool</strong>. This pool stores all the different strings declared in the code. When you create a new variable with the same value (a student with the same name), it simply points to the location of the value in the String Constant Pool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49nKzkzCAcLmf4PJ3GMHXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NXCueIUMu31qM3pRQPS4Eg.png" /></figure><p>We can test this using the id() function, which returns the memory address of the data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvqTp_LLzMPIAUzMbUnkQw.png" /></figure><p>As we can see, the memory address of those two variables is the same, meaning that both variables point to the same memory location.</p><h3>But why is it a problem to change the string value?</h3><p>Let’s return to the classroom example:</p><p>Imagine that one of the students suddenly realizes they misspelled their name and it’s not “George” but “Geordie”. If they change the name “George” on the board, all the circles are now wrong since other students are indeed named “George”. So, the best option here is for Geordie to write his actual name somewhere else on the board, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6l6Gbz1rCg2YqgkIsiGXrA.png" /></figure><p>So what he did here is write a new name on the board instead of changing the existing one to avoid fight with the other students named George.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHumdHGkxA_FWzUouq216w.png" /></figure><p>Now, we can understand what’s going on under the hood whenever we declare string variables with the same values. The identical ones point to the same place in memory, while the different ones point to somewhere else.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2h11LGpUGDqpWiQgpp9G9g.png" /></figure><p>If you understand this concept in Python, you pretty much understand it in Java, JavaScript, and any other language that uses it. They all save space and reduce runtime by storing strings in a special place in memory called the String constant pool.</p><blockquote>In conclusion, strings are immutable because more than one variable may be pointing to them. Changing a string would affect all other variables pointing to it. So, whenever we want to modify an existing string, we simply create a new string instead.</blockquote><p>Thanks for reading the whole thing, I made it all up.</p><p>JK.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29e07c7fa64b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What the hell is hashing?]]></title>
            <link>https://medium.com/@beqa3352/what-the-hell-is-hashing-da9d18f660a0?source=rss-8055d81fd0fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/da9d18f660a0</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hashing]]></category>
            <dc:creator><![CDATA[Beqa]]></dc:creator>
            <pubDate>Fri, 19 Apr 2024 18:57:32 GMT</pubDate>
            <atom:updated>2024-04-19T18:57:32.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/565/0*grlKp2dZ574-obWT.png" /></figure><p>You see the word “<strong>hashing</strong>” everywhere but still aren’t sure what it is, how it works, and why it’s such a crucial concept in computer science? No worries, bud. you’ll know everything you need to know about hashing after reading this article, so sit comfortably and turn on your imagination.</p><h3>What is hashing?</h3><p>Imagine that you wanna send an envelope with a message to your friend. That message is something important that only you and he should know. You fear that the postman or someone else will open that envelope and read that secret text, so you think what to do while you have aha moment: you decide to write that message in some kinda secret way which will be difficult for other people to read, now you think of ways to do that… the first thing that comes to your mind is to replace all the vowels in the text with numbers (a-1, e-2, i-3, o-4, u-5), now the words <strong>Hello </strong>and <strong>Car </strong>become <strong>H2ll4 </strong>and <strong>C1r. </strong>Not bad at all, right? now it’s harder to read the text with those strange words. But you can guess that this is not the way to go, even if someone struggles to read that text, they can easily figure out the logic behind the whole thing. So you need a better logic to make your message unreadable. That’s where <strong>hashing </strong>comes in, <strong>hashing</strong> is a technique to encode data so that other people can’t read it.</p><blockquote><strong>Where can we use hashing?</strong></blockquote><blockquote>Everywhere: passwords, text messages, card information, transactions, etc.</blockquote><h3>The most popular hashing technique</h3><p>the most popular and widely trusted hashing technique is the SHA-256 algorithm. SHA-256, which stands for Secure Hash Algorithm 256-bit. You don’t need to know the exact details how it works (you can imagine it as a bunch of calculations) that gives us the hash value which is so different from the input text that you’ll need a lifetime to decode it (you’d probably fail). Just to visualize how it works, here’s an example:</p><blockquote>Input: Hello</blockquote><blockquote>0utput: 185f8db32271fe25f561a6fc938b2e264306ec304eda</blockquote><blockquote>Input: Car</blockquote><blockquote>Output: a5cdf07dbbc15892dcb64f1553ebb474330393705ce</blockquote><blockquote><em>You can test it yourself </em><a href="https://www.cleancss.com/sha256-hash-generator/">here</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*74g0svNbXl-PP3u0.gif" /></figure><h3>So hashing is just securing data, right?</h3><p>No, hashing is not only used to secure data but also to retrieve it quickly. Let’s once again turn to our greatest teacher: our imagination.</p><p>Imagine your friend gives you a map and a key. They ask you to find a specific door, unlock it with the key, and get their puppy. You finally reach the place marked on a map, you look up and see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*Ll7w-hKsP2f59sZY" /></figure><p>Well, you have only one key, but there are multiple doors. What would you do? You would try the key on the first door, then the second door… If you’re unlucky and the puppy is behind the last door, you would have tried the key on every door. That takes time, doesn’t it?”</p><p>Now imagine the exact same situation with one major difference, your friend has told you that the door that key opens is <strong>red. </strong>Now, you only need to open one door, and that’s it! You’ve found the puppy, and you both can run away to a place where your friend will never find you.</p><p>What was the difference between those two situations? In the first scenario, you didn’t know where to look exactly, so you had to check every door in a worst-case scenario. However, in the second situation, you already knew where to look, saving time by checking the right door on the first try. That’s what hashing does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*C7TNRYRchho3nE2Z.gif" /></figure><p>As you can see from this animation, once we have a value, we figure out where it should go in the computer’s memory. We do this by doing a special calculation called <strong>hashing</strong>. This calculation gives us a specific spot where we can store the value. Later, when we need to find that value again, we use the same calculation to figure out where it’s stored. This makes it easy and fast to get the value whenever we need it. So, hashing helps us organize and find data (puppy) quickly in our computer’s memory, because we got the exact location (the color of the door).</p><p>Thanks for reading the whole thing. this is my first time writing a technical article (not easy at all) if you found it helpful and if it made hashing understandable, like or follow or whatever, I don’t know how this medium thing works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da9d18f660a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>