{"id":149,"date":"2020-04-21T00:56:36","date_gmt":"2020-04-21T00:56:36","guid":{"rendered":"https:\/\/www.npasson.com\/blog\/?p=149"},"modified":"2020-04-21T00:56:37","modified_gmt":"2020-04-21T00:56:37","slug":"tech-for-beginners-passwords","status":"publish","type":"post","link":"https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/","title":{"rendered":"Tech for Beginners: Passwords"},"content":{"rendered":"\n<p>A password is used to log in to most websites and services. But why do people tell you that &#8220;potato&#8221; isn&#8217;t a good password to use? And why should you use a different password for every website?<\/p>\n\n\n\n<!--more-->\n\n\n<div class=\"ub_table-of-contents\" data-showtext=\"show\" data-hidetext=\"hide\" data-scrolltype=\"auto\" id=\"ub_table-of-contents-bfa12226-ba90-4069-ba1b-e6129214d8d5\"><div class=\"ub_table-of-contents-header\">\n                    <div class=\"ub_table-of-contents-title\">Content<\/div><\/div><div class=\"ub_table-of-contents-container ub_table-of-contents-1-column \"><ul><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#0-technical-basis>Technical basis<\/a><ul><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#1-hash-function>Hash function<\/a><\/li><\/ul><\/li><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#2-the-useful-part>The useful part<\/a><ul><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#3-different-passwords>Different passwords<\/a><\/li><\/ul><\/li><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#4-summary>Summary<\/a><\/li><li><a href=https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/#5-technical-disclaimer>Technical disclaimer<\/a><\/li><\/ul><\/div><\/div>\n\n\n<h2 id=\"0-technical-basis\">Technical basis<\/h2>\n\n\n\n<p>I&#8217;ll keep this section short, but there&#8217;s a few things you *need* to know for this part.<\/p>\n\n\n\n<h3 id=\"1-hash-function\">Hash function<\/h3>\n\n\n\n<p>Don&#8217;t worry, this isn&#8217;t math. The theory behind it is math, but I&#8217;ll try to skip most of it.<\/p>\n\n\n\n<p>First, we&#8217;ll explain what a *hash value* is. A hash value is a kind of word with a fixed amount of characters. Here, we&#8217;ll use a popular hash value length of 16 characters. An example of such a hash value looks like this:<\/p>\n\n\n\n<p class=\"has-text-color has-background has-very-dark-gray-color has-very-light-gray-background-color\">  <strong>c257d3eea046aff0d2613da918ca424d<\/strong> <\/p>\n\n\n\n<p>It doesn&#8217;t make any sense to a human, it&#8217;s just the result of a mathematical calculation.<\/p>\n\n\n\n<p>This hash value is the result of a so-called <strong>hash function<\/strong>. A hash function is nothing more than a mathematical function that asks for anything, usually a word, sentence or even a password, and uses it mixed with some black magic to generate a hash value. Examples include:<\/p>\n\n\n\n<ul><li>Using <strong>potato<\/strong> gives you <strong>8ee2027983915ec78acc45027d874316<\/strong><\/li><li>Using <strong>password<\/strong> gives you <strong>5f4dcc3b5aa765d61d8327deb882cf99<\/strong><\/li><li>Using very-complicated-password-1234 gives you  <strong>158a09c78b85b0116b81be315e56f749<\/strong><\/li><\/ul>\n\n\n\n<p>As you can see, even if we use a long password, the length of the hash value doesn&#8217;t change. Why is this useful? Imagine this:<\/p>\n\n\n\n<p>Say you have a hash value length of just 1 character. Say the words <strong>potato<\/strong> and <strong>password<\/strong> both result in a hash value of <strong>B<\/strong>. Now, if you just saw this B, could you tell me which word was used?<\/p>\n\n\n\n<p>No, you couldn&#8217;t, and that&#8217;s the most important thing we use hash functions for. Every hash value has an infinite amount of words that have it as result. If I gave you the hash value from the beginning, could you tell me which word I used? No, no one can. The only way to get to the hash is to know what word I used.<\/p>\n\n\n\n<p class=\"has-text-color has-cyan-bluish-gray-color\">(Note: I said there are an infinite number of words that result in the same hash value, and that&#8217;s true, but there are a *lot* of combinations you&#8217;d have to try. For the most popular hash function you&#8217;d need to try 13,407,807,929,942,597,099,574,024,998,205,846,127,479,365,820,592,393,377,723,561,443,721,764,030,073,546,976,801,874,298,166,903,427,690,031,858,186,486,050,853,753,882,811,946,569,946,433,649,006,084,096 different words before you have a chance (which is close to the amount of atoms in the universe), so attempting it is futile. If you&#8217;re feeling smart, do try to find out what sentence I used at the beginning. The hash function is called MD5.)<\/p>\n\n\n\n<h2 id=\"2-the-useful-part\">The useful part<\/h2>\n\n\n\n<p>That was a lot of math, wasn&#8217;t it? Let&#8217;s ease up now. To sum up:<\/p>\n\n\n\n<ul><li>A hash function uses a word or sentence to turn it into a word (hash value) with a fixed length.<\/li><li>If you have just the hash value, you have no way of knowing what word we started with.<\/li><\/ul>\n\n\n\n<p>Some of you might say &#8220;But wait a second! You listed some above, so I know for sure that  <strong>8ee2027983915ec78acc45027d874316<\/strong> is the hash value of <strong>potato<\/strong>!&#8221; And yes, you&#8217;re completely right! This is an important point and we&#8217;ll get back to it later.<\/p>\n\n\n\n<p>What are hash functions useful for? Imagine this: You log into a website with a username and a password, which saves both. The website data gets out somehow, and now you have your password on the internet. Ugh.<\/p>\n\n\n\n<p>But imagine if the website didn&#8217;t save your password, but just the <strong>hash value<\/strong> of your password! That way, if the data got out, no one would know your password because they just knew the hash values (and remember, you can&#8217;t know what word it was generated with)! In fact, this is how websites these days work.<\/p>\n\n\n\n<ol><li>You register on a website with a password.<\/li><li>The website generates the hash value of your password, and saves that.<\/li><li>When you login again, you input your password.<\/li><li>The website generates the hash value of the password you entered and compares it to the saved hash value.<\/li><li>If they&#8217;re the same, congrats, you got in!<\/li><\/ol>\n\n\n\n<p>Now, if you can&#8217;t know the word that was used, why do we need to use good passwords? I can just use <strong>potato<\/strong>, and no one will know because the password is hashed! Right?<\/p>\n\n\n\n<p>&#8230;but wait a second. I listed the hash value of <strong>potato<\/strong> up there. It&#8217;s no longer secret. If people just search for <strong>8ee2027983915ec78acc45027d874316<\/strong>, they will find this and know it&#8217;s the result of <strong>potato<\/strong>!<\/p>\n\n\n\n<p>This is how it works in the real world. Surely you have seen articles about &#8220;<em>These are the 10 most used passwords<\/em>&#8221; and so on. All the evil people do is take a list like that (for example <a href=\"https:\/\/github.com\/DavidWittman\/wpxmlrpcbrute\/blob\/master\/wordlists\/1000-most-common-passwords.txt\">this one<\/a>), generate the hash value of each of them, and then they have a list! Try it yourself <a href=\"https:\/\/www.md5online.org\/md5-decrypt.html\">here<\/a>! Take each of the hash values in the list above and paste them into the site. You&#8217;ll see that only one of them cannot be found, and that is the long complicated password! (of course, at some point the website will find it, because I just posted it here.)<\/p>\n\n\n\n<p>I didn&#8217;t even have to tell you, because you just saw with your own eyes that more complicated passwords are more secure!<\/p>\n\n\n\n<h3 id=\"3-different-passwords\">Different passwords<\/h3>\n\n\n\n<p>Now, why should you use different passwords on different sites? Because, as it turns out, programmers are lazy. Why use this fancy pants hash thing if you can <a href=\"https:\/\/plaintextoffenders.com\/about\/\">just save the password<\/a>? No one will hack us anyways, right?<\/p>\n\n\n\n<p>&#8230;even the best hash function can&#8217;t save you if it isn&#8217;t used.<\/p>\n\n\n\n<h2 id=\"4-summary\">Summary<\/h2>\n\n\n\n<ul><li>Use secure passwords, for example using <a href=\"https:\/\/passwordsgenerator.net\/\">this generator<\/a>.<\/li><li>Don&#8217;t reuse passwords &#8211; if just one site doesn&#8217;t use hashes, your precious password will be at risk!<\/li><li>If a site can send you your password (for example through email), then <strong>they&#8217;re storing it instead of using a hash function! <\/strong>Consider not using the site and make sure you don&#8217;t use the password anywhere else.<\/li><\/ul>\n\n\n\n<h2 id=\"5-technical-disclaimer\">Technical disclaimer<\/h2>\n\n\n\n<p>(this is no longer part of the article, it is just some technical details about the article)<\/p>\n\n\n\n<ul><li>I used MD5 because even though it&#8217;s evil, it&#8217;s short and digestible by a beginner.<\/li><li>The number of tries was generated by using the bit count of SHA-512 and equates to 2<sup>512<\/sup>.<\/li><li>If you ever find out what I used for the hash at the beginning, email me and I&#8217;ll make sure to list you here.<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A password is used to log in to most websites and services. But why do people tell you that &#8220;potato&#8221; isn&#8217;t a good password to<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.npasson.com\/blog\/tech-for-beginners-passwords\/\">Continue Reading<span class=\"screen-reader-text\">Tech for Beginners: Passwords<\/span> <i class=\"fas fa-angle-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"ub_ctt_via":""},"categories":[10],"tags":[],"featured_image_src":null,"author_info":{"display_name":"npasson","author_link":"https:\/\/www.npasson.com\/blog\/author\/npasson\/"},"_links":{"self":[{"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/posts\/149"}],"collection":[{"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":9,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":158,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/posts\/149\/revisions\/158"}],"wp:attachment":[{"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.npasson.com\/blog\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}