<?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: Stephen</title>
    <description>The latest articles on Forem by Stephen (@stephepush).</description>
    <link>https://forem.com/stephepush</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%2F187973%2Fce7f6c39-2c43-428d-8a74-8077753fdb66.jpeg</url>
      <title>Forem: Stephen</title>
      <link>https://forem.com/stephepush</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/stephepush"/>
    <language>en</language>
    <item>
      <title>Password Security: A bit deeper dive into Hashes, Salts, Bcrypt and Node's Crypto module.</title>
      <dc:creator>Stephen</dc:creator>
      <pubDate>Fri, 12 Nov 2021 02:46:15 +0000</pubDate>
      <link>https://forem.com/stephepush/password-security-a-bit-deeper-dive-into-hashes-salts-bcrypt-and-nodes-crypto-module-7l7</link>
      <guid>https://forem.com/stephepush/password-security-a-bit-deeper-dive-into-hashes-salts-bcrypt-and-nodes-crypto-module-7l7</guid>
      <description>&lt;p&gt;As I finished much of the administration portion of the current project I'm working on, I started to explore possible solutions for authentication within the app. I spent a good portion of last month going through a tutorial series made by Zach Gollwitzer (link to it on &lt;a href="https://youtu.be/F-sFp_AvHc8" rel="noopener noreferrer"&gt;freeCodeCamp's youtube page&lt;/a&gt; as well as the &lt;a href="https://youtu.be/z7872Nki5FY" rel="noopener noreferrer"&gt;playlist Zach's own youtube channel&lt;/a&gt;). The tutorial seems pretty comprehensive, it begins with a review of using Express middle-ware, because moving forward, you use lots of middle-ware throughout the rest of the series. The series then moves on to using PassportJS, the Passport Local Strategy and Sessions, and then to using PassportJS with Javascript Web Tokens (JWT) with Passport and then to JWTs by themselves in an angular front-end. I didn't actually go through the very end, which was the part where you implement a JWT in a Angular front-end because I wanted to get back to working on my own project. Transitioning back, I had to think about how I wanted to implement a user authentication system. Did I want to use Passport-Local with sessions? Did I want to use JWTs? I decided to go with what I found easiest while following along with the tutorial, which was using Passport Local and sessions, especially since this is the first time I'd be implement authentication and because I want to get &lt;a href="https://github.com/stephepush/carDealership" rel="noopener noreferrer"&gt;this project&lt;/a&gt; done with.&lt;/p&gt;

&lt;p&gt;In Zach's course, he used NodeJS' built-in 'crypto' module to produce hashes and salts. Admittedly, I followed the tutorial and just let the magic happen without trying to understand what was actually going on because I wanted to understand how passport worked. In my own research that followed, I found that many developers seemingly preferred the bcrypt standard as opposed to Node's crypto module. A google search will send you down &lt;a href="https://stackoverflow.com/questions/43377163/what-is-difference-between-crypto-and-bcrypt" rel="noopener noreferrer"&gt;multiple&lt;/a&gt; &lt;a href="https://stackoverflow.com/questions/65058513/bcrypt-vs-script-crypto-which-one-is-most-secure" rel="noopener noreferrer"&gt;rabbit holes&lt;/a&gt; &lt;a href="https://stackoverflow.com/questions/6951867/nodejs-bcrypt-vs-native-crypto" rel="noopener noreferrer"&gt;comparing the pros&lt;/a&gt; and &lt;a href="https://www.reddit.com/r/node/comments/4u1jcn/is_bcrypt_the_best_possible_password_hashing/" rel="noopener noreferrer"&gt;cons of using&lt;/a&gt; Node's Crypto module, or one of npm's bcrypt packages (there's a version that hooks into the V8 engine's C++ underpinnings, while there's another that is totally written in JS and can be run in the browser). So here's some of the advantages of using Node's Crypto Module or Bcrypt that I gleaned:&lt;/p&gt;

&lt;h2&gt;
  
  
  Bcrypt Advantages:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Seeming industry standard and widely accepted&lt;/li&gt;
&lt;li&gt;bycrypt npm package drills into V8's C++ underpinnings, more performant&lt;/li&gt;
&lt;li&gt;bcryptjs is javascript from the ground up, and can be used in the browser (for whatever reason)&lt;/li&gt;
&lt;li&gt;the bcrypt modules parse salt and hash automagically and only requires one db table column&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Node Crypto Module Advantages:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Built into Node, no reliance on dependencies that could one day inject malicious code&lt;/li&gt;
&lt;li&gt;No need to install&lt;/li&gt;
&lt;li&gt;I'm already familiar with it 😁&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the process of learning more about bcrypt, I learned more about how hashing and salting worked by watching a number of &lt;a href="https://www.youtube.com/watch?v=GI790E1JMgw" rel="noopener noreferrer"&gt;great&lt;/a&gt; and &lt;a href="https://www.youtube.com/watch?v=YLCoDK0OwYM" rel="noopener noreferrer"&gt;informative&lt;/a&gt; &lt;a href="https://youtu.be/ro1WmoP4CZs" rel="noopener noreferrer"&gt;videos&lt;/a&gt; on the topic. I'll attempt to briefly explain it in my own words in the next section.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashing and Salting: a quick and dirty primer
&lt;/h2&gt;

&lt;p&gt;If I could explain what hashing and salting is in my own words (because, it turns out it's a beautifully thought out method of password protection and authentication):&lt;/p&gt;

&lt;p&gt;A password is first hashed using a hashing algorithm. Algorithms like blowfish and argon2 associate a random set of characters to a given word or string of characters (in the case of a user, a password). After the assignment of those random characters (in the case of bcrypt, 31 characters represents a given entered string), the actual password is lost forever, and whatever the user enters is converted to a hash and compared to the hash that was stored in the database after their initial database entry. If the two compared hashes match (the initial passwords hash will always look like that even if the password is forgotten), the user is granted access because they entered a string of characters whose hash equivalent matches the stored hash in the database. &lt;/p&gt;

&lt;p&gt;While this solution itself is clever and elegant, there's an underlying inherent problem; if the password is too simple, a simple word or number combination, or even a word and combination (such as 'BuffaloBills99' or 'NWO4Life'), the corresponding hash may already have been discovered by hackers generating whats called rainbow tables using dictionaries of words and concatenating digits at the end. If a system is hacked, and malicious parties obtain the database with these simple hashes, they could match at least a few of the entries using rainbow tables because there are at least a few users who will, unfortunately enter easily cracked password entries. Along with that, there may be users who use the same password, which would, in turn, generate the same hash value, and if a hacker or malicious party figures out that hash value for one, they could search the whole password hash table for matches. &lt;/p&gt;

&lt;p&gt;The solution to adding complexity to a given hash by default is by adding a salt, another random set of strings to the hashed password to derive a &lt;em&gt;new&lt;/em&gt; hash. Ideally, each password hash would have its very own random salt paired it to create individually unique hashes so that even if there are multiple matches among the first round of hashes, those matches would be obscured by the newly given salts. While its necessary to record the explicit salt paired with each password hash, and the salt is known to anyone who accesses the database table, a malicious party would have to first un-salt each salted hash to even start seeing matching hashes. This may sound like a worthwhile task, but what if the password table contains millions of rows? And the malicious party may still not be able to figure out what the unsalted hashes mean even if there are matches! Remember time is a resource we can't get back!&lt;/p&gt;

&lt;p&gt;So, anyways, the way Node's Crypto and Bcrypt/BcryptJS handle hashes is a bit different between their two paradigms. Node's crypto produces a salted hash and the salt, requiring the developer to make two database columns to store each, while the bcrypts return a value with the combine salted hash and salt, and bcrypt has its own methods that can use the integrated salt value to unsalt the salted hash value. This in turn requires a single table column in a given database.&lt;/p&gt;

&lt;p&gt;A given bcrypt method produces a bcrypt hashstring in the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
\__/\/ \____________________/\_____________________________/
Alg Cost      Salt                        Hash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Bcrypt" rel="noopener noreferrer"&gt;Source: Wikipedia&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bcrypt produces a string where the salt is 22 characters long and the (salted) hash is 31 characters long, along with a few characters that indicate the precise algorithm being used and the 'cost' (or how many times a salt string is randomized/salted?... I'm still a bit murky on understanding that). &lt;/p&gt;

&lt;p&gt;While, again, the &lt;code&gt;node-crypto&lt;/code&gt; module, provides individual hash and string values that you can conveniently store in two columns of your preferred database:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbxbytes.com%2Fwp-content%2Fuploads%2F2021%2F11%2Fhash_saltMariaDBTbl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fbxbytes.com%2Fwp-content%2Fuploads%2F2021%2F11%2Fhash_saltMariaDBTbl.jpg" alt="The hash value is 128 characters long"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h6&gt;
  
  
  The hash value is 128 characters long, above, so it couldn't be all be shown on screen.
&lt;/h6&gt;

&lt;p&gt;Two distinctive ways to handle the same problem, with bcrypt's being a bit more clever, at least in my opinion.&lt;/p&gt;
&lt;h2&gt;
  
  
  This is a coding blog afterall...
&lt;/h2&gt;

&lt;p&gt;I guess I could share some comparative samples of code used to generate the hash and salt using a &lt;code&gt;bcrypt&lt;/code&gt; and &lt;code&gt;crypto&lt;/code&gt; npm module. The crypto sample is from tutorial I wrote about earlier, and the bcrypt sample is from a little node project/sandbox I conjured up this past Sunday to better understand how bcrypt worked without mucking up my current main project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const bcrypt = require('bcryptjs');

async function hashesString(userInput) {
    const password = userInput
    const saltRounds = 15;

    const userInputHashed = await bcrypt.hash(password, saltRounds)
    return userInputHashed;

}

module.exports.hashesString = hashesString
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;bcrypt&lt;/code&gt; module provides &lt;code&gt;bcrypt.hash()&lt;/code&gt; (also &lt;code&gt;bcrypt.compare()&lt;/code&gt;) methods that you can nest within async functions so that the server can do other things while all of the computationally intensive hashing rounds happen. &lt;/p&gt;

&lt;p&gt;I then imported that async function to the file holding the relevant route (in this small project, I just put the routes in app.js):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { hashesString, passwordCheck } = require('./bcryptUtil');

app.post('/submit-form', (req, res) =&amp;gt; {
    const userInput = req.body.string;
    hashesString(userInput)
        .then((output) =&amp;gt; {
            console.log(output);
            res.send(JSON.stringify({ output: output }))


        })
        .catch(err =&amp;gt; console.log(err))
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now for the code from the authentication tutorial I followed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const crypto = require('crypto');



function genPassword(password) {
    let salt = crypto.randomBytes(32).toString('hex'); 
    let genHash = crypto.pbkdf2Sync(password, salt, 10000, 64, 'sha512').toString('hex');

    return {
        salt: salt,
        hash: genHash
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hash generation functionality within the &lt;code&gt;crypto&lt;/code&gt; module is a bit more involved, here's what the parameters are for the method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where password is normally the string input entered by a given user, salt itself can be derived by another method (in the above code its created using the &lt;code&gt;crypto.randomBytes&lt;/code&gt; method, 'iterations' are seemingly the crypto module's equivalent of asking for the number of rounds, 'keylen' allows the developer to determine the length of the resulting hash, and 'digest' seems to be the algorithm used to generate the hash.  &lt;/p&gt;

&lt;p&gt;Here's &lt;code&gt;genPassword&lt;/code&gt; being used in a route method, my comments and all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const genPassword = require('../lib/passwordUtils').genPassword


router.post('/register', (req, res, next) =&amp;gt; {
    const saltHash = genPassword(req.body.pw);
    /*^ passes collected password to genPassword from passwordUtils*/

    const salt = saltHash.salt;
    /* ^Holds value of salted saltHash 
        returned from genPassword */

    const hash = saltHash.hash;
    /* ^Holds value of salted and hashed 
        saltHash returned from genPassword */

    const username = req.body.username;

    const admin = false;

    let newUser = new User(

        username,
        //^takes username value entered from form
        hash,
        //^stores salted and hashed password
        salt,
        //^stores salted password
        admin
    )

    newUser.save()
        .then((newUser) =&amp;gt; {
            console.log(newUser)
        });
    //save is a method for the database
    res.redirect('/login'); //redirects back to login page
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The method above may look longer but it does much more than the bcrypt post method; as opposed to just console logging the hash, here, the username, hash, and salt could be sent to the a database (the method also console logs the new user info because dev environment), and then the server redirects the browser to the &lt;code&gt;/login&lt;/code&gt; route. &lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion...
&lt;/h2&gt;

&lt;p&gt;So if it isn't clear to you yet, I might have written this article to explain how hashes and salts work, as well as to try and figure out whether to use &lt;code&gt;bcrypt&lt;/code&gt; or node's &lt;code&gt;crypto&lt;/code&gt; module to do the hashing and salting in the project I'm currently working on. To be honest, I still can't pick one. I'm more partial to &lt;code&gt;crypto,&lt;/code&gt; and yeah, it's dependencies don't have the magic ability to become malicious one day because it's built into node. But bcrypt, &lt;code&gt;bcryptjs,&lt;/code&gt; to be precise, seems a bit easier to use. So the stalemate continues. I at least hope that you, the reader, come out of this with a better understanding of how passwords are normally stored in databases. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you'd like to take a look at the little experimental sandbox I put together, &lt;a href="https://github.com/stephepush/bcryptExperiment" rel="noopener noreferrer"&gt;here's the link&lt;/a&gt;. &lt;a href="https://github.com/stephepush/authSandbox" rel="noopener noreferrer"&gt;Here's the link&lt;/a&gt; to my implementation of Zach Gollwitzer's code throughout his authentication tutorial which I linked to above. I used MariaDB instead of MongoDB because I think relational databases are cool too.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;**&lt;em&gt;This post is also up on my wordpress blog at bxbytes.com. &lt;a href="https://bxbytes.com/index.php/2021/11/11/password-security-a-bit-deeper-dive-into-hashes-salts-bcrypt-and-nodes-crypto-module/" rel="noopener noreferrer"&gt;Link here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>security</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>PUT vs. PATCH: A Conceptual Dive into their Differences.</title>
      <dc:creator>Stephen</dc:creator>
      <pubDate>Tue, 09 Jun 2020 12:21:52 +0000</pubDate>
      <link>https://forem.com/stephepush/put-vs-patch-a-conceptual-dive-into-their-differences-34be</link>
      <guid>https://forem.com/stephepush/put-vs-patch-a-conceptual-dive-into-their-differences-34be</guid>
      <description>&lt;h2&gt;
  
  
  Intro -- Staring down HTTP method the rabbit hole
&lt;/h2&gt;

&lt;p&gt;Last week, while meeting (over Zoom) with my morning discussion group from the Flatiron School, we found ourselves looking at a list of HTTP verbs to try and match them with their respective CRUD (create, read, update, and delete) actions. We found that two verbs, at first glance, could both fulfill update duty for a web application, so we decided to take a deeper look, even if it was for five minutes. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l2SpUEiwphoktXT4Q/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l2SpUEiwphoktXT4Q/giphy.gif" alt="Star Trek TNG characters Data and Worf beaming onto an alien ship"&gt;&lt;/a&gt;&lt;/p&gt;
POST method, Hyper Matter Transport Protocol, circa 24th century



&lt;p&gt;The most alert among us (it was about 9:30 AM) quickly skimmed stack overflow threads on the topic aloud. The prevailing summary we gathered from our brief google excursion was that PUT is used to just update a whole file, while Patch is used for updating only specific portions. Upon looking for a good enough description, I found this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With PATCH... the enclosed entity contains a set of instructions describing how a resource currently residing on the origin server should be modified to produce a new version.&lt;/p&gt;
Source: https://stackoverflow.com/a/21661036/5456075 

 
&lt;/blockquote&gt;

&lt;p&gt;Of course, that couldn't be enough for me. I wondered further, "which came first? PUT or PATCH? Is PATCH some old HTTP verb from the 90s?" &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/ik4ckLyRQe6YM/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/ik4ckLyRQe6YM/giphy.gif" alt="Alice In Wonderland "&gt;&lt;/a&gt;&lt;/p&gt;
Of course I'll write a blog that requires me to read Internet Engineering Task Force specification documentation!



&lt;h2&gt;
  
  
  What I found
&lt;/h2&gt;

&lt;p&gt;I decided to go straight to the primary source of information regarding the PATCH verb, the &lt;a href="https://tools.ietf.org/html/rfc5789" rel="noopener noreferrer"&gt;PATCH proposal documentation from the Internet Engineering Task Force&lt;/a&gt;, where I was able to confirm (based on what a group mate previously told me) that the PATCH verb was a recent addition to the Hypertext Transfer Protocol, the method was proposed in March 2010, long after many in the most developed nations have moved on from slow dial up connections could have reaped benefits from a seeming incrementally updating feature. By contrast, the PUT method was proposed in 1999 (&lt;a href="https://qr.ae/pNKpbo" rel="noopener noreferrer"&gt;here&lt;/a&gt; is a great Quora response that cleverly answers the difference between PUT, POST and PATCH).&lt;/p&gt;

&lt;p&gt;A big difference between PUT and PATCH is that the PUT method is &lt;strong&gt;&lt;em&gt;idempotent&lt;/em&gt;&lt;/strong&gt;, or that, every instance of a given data update via PUT method will be the same (an example would be mashing a submit button that sends the same data in a put request... the data can be sent 100 times and it will be the same). That's a clear difference to the nature of the PATCH method, which allows updates to a specific part of a larger resource. While PUT always overwrites a whole resource, and an instance of an update doesn't change, every instance of a PATCH request doesn't have to be the same, or idempotent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The nature and resulting problems with using PATCH
&lt;/h2&gt;

&lt;p&gt;Lacking the necessity of being the same, there comes other inherent ramifications to using a PATCH request as opposed to a PUT request. Because there are formats and standards to send data, application of a patch method is inherently non-universal. In plainer english, in almost every differing format of data, a developer will have to come up with a new wheel design to update a small part of that resource using patch. While it might be easy to change send a key value pair in a JSON collection, it might be much harder to try and change a line of text stored within a blob in a relational database table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz3b8k0a6x0nbptocqlwa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fz3b8k0a6x0nbptocqlwa.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
An example of a PATCH request being shorter than a PUT request by sending specific data. From https://stackoverflow.com/a/21661036/5456075



&lt;p&gt;A developer also has to weigh the risk that, with making custom headers and means to patch an update to a given type of resource, the resulting PATCH method might be bigger than just using a PUT method that simply overwrites the whole older version of a resource. Other potential horrors awaiting a developer if they attempt to implement a system utilizing PATCH updates include: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Potential staleness of requests (if a newer request reaches the server before the older one).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Malformed, or improperly formatted, patch documents (possibly as a result of lack of a universal standard formatting for the patch method). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Servers improperly configured to support PATCH requests. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, the incremental/piecemeal nature of PATCH requests makes it easier for bad actors to gradually send malware such as a virus that can gradually be "patched" together on a receiving server (it's much harder to do this with PUT and POST requests).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, these are all downsides if a developer wants to build a solution from scratch. As I learned recently, frameworks such as Ruby On Rails utilizes PATCH requests effortlessly because of the collective brainpower that goes into developing solutions of that scale. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion -- And Thinking Fourth Dimensionally
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/eIgv5qxtoIjLU03CBS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/eIgv5qxtoIjLU03CBS/giphy.gif" alt="Steam Engine going off Cliff, Back To The Future Part 3"&gt;&lt;/a&gt;&lt;/p&gt;
Don't worry Marty, tracks will be there in 100 years



&lt;p&gt;&lt;em&gt;So, why care about the differences of PUT and PATCH? Why care about how it's implemented if it's already utilized in frameworks like Rails, I won't ever care to know the difference!&lt;/em&gt; Maybe you won't, but the method was only proposed in 2010, it's been around for a short amount of time compared to other HTTP verbs. When PUT was first introduced, it took time for its usage to be adapted because of the perceived overlap it shared with POST, but now, the two are used for separate and important concerns. The reason why I wondered if PATCH was a holdover from some bygone era involving 56k modems was because of the potential for the method to send small amounts of data, something that would speed up internet communication for users using low bandwidth or unreliable connections. In the west, we may have moved away from 2g and 56k modems, but the developing world is only now getting access to relatively expensive, data capped connections to the internet. &lt;/p&gt;

&lt;p&gt;While users in the developed world can wave off such considerations of importance and savings of data utilization, developers have to consider the problems and frustrations users in the developing world face. The internet of the near future cannot always be about transferring Cadillac sized requests between client and server, and considering more specific and concise requests will be ideal. &lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH" rel="noopener noreferrer"&gt;MDN: PATCH&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/21660791/what-is-the-main-difference-between-patch-and-put-request" rel="noopener noreferrer"&gt;StackOverflow: What is the main difference between PATCH and PUT request?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://qr.ae/pNKpbo" rel="noopener noreferrer"&gt;Quora: What is the difference between the PUT and PATCH requests in HTTP? Response by Aaron Evans&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=6dVNdFwqeKs" rel="noopener noreferrer"&gt;Youtube: Idempotency in Cows And Rest APIs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>todayilearned</category>
      <category>todayisearched</category>
    </item>
  </channel>
</rss>
