{"id":2799,"date":"2024-10-22T10:11:05","date_gmt":"2024-10-22T10:11:05","guid":{"rendered":"https:\/\/apex-aiexperts.com\/?p=2799"},"modified":"2024-10-22T10:11:05","modified_gmt":"2024-10-22T10:11:05","slug":"what-is-hashing","status":"publish","type":"post","link":"https:\/\/apex-aiexperts.com\/es\/what-is-hashing\/","title":{"rendered":"What is Hashing?"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Before diving into the subject of Bitcoin mining, we need to take a quick detour and learn about a certain concept that\u2019s foundational to cryptocurrencies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to truly understand how Bitcoin and other cryptocurrencies work, it\u2019s crucial to first understand the concept of \u201c<strong>hashing<\/strong>\u201c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you see the word, \u201chash\u201d, some folks might think of hash browns, a popular American breakfast food, while other folks like Snoop Dogg, might think of the cannabis concentrate product.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this lesson, I will be talking about&nbsp;<strong>a different kind of hash<\/strong>!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s a technical concept, but one you must be familiar with so&nbsp; I will break it down for you nice and easy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Being familiar with the concept of hashing is also needed to\u00a0<strong>understand how Bitcoin mining works<\/strong>\u00a0(which is the next guide) so\u00a0<strong>please don\u2019t skip over these lessons<\/strong>.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is hashing?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Hashing<\/strong>&nbsp;is a method of cryptography that converts any form of data into a unique string of text of fixed length.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Cryptography<\/strong>&nbsp;is the practice and study of techniques for secure communication from outside observers. In the internet era, cryptography is used to protect computer information or \u201cdata\u201d.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">If it wasn\u2019t already obvious, the \u201ccrypto\u201d in cryptocurrencies stands for&nbsp;<em>cryptography<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Hashing is a fundamental part of cryptography<\/strong>. And plays a huge role behind the \u201ccrypto\u201d in cryptocurrencies.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In simple terms, hashing means&nbsp;<strong>inputting text<\/strong>&nbsp;of ANY length through a&nbsp;<strong>funci\u00f3n hash<\/strong>&nbsp;which produces an&nbsp;<strong>output of a FIXED length<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any piece of data can be \u201c<strong>hashed<\/strong>\u201d, no matter its size, type, or length.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The hash that is produced is&nbsp;<strong>always the same length<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the examples below, using the&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/SHA-1\" target=\"_blank\" rel=\"noreferrer noopener\">SHA-1<\/a>&nbsp;hash function, regardless of the length of the \u201cinput\u201d, the \u201coutput\u201d is always&nbsp;<strong>40 characters long<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a quick comparison of the three examples:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>INPUT<\/th><th>HASH<\/th><\/tr><\/thead><tbody><tr><td>Hello<\/td><td>f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0<\/td><\/tr><tr><td>BabyPips.com<\/td><td>8c8780d0b70c5ef42a534846cc042629cf07a440<\/td><\/tr><tr><td>I<\/td><td>ca73ab65568cd125c2d27a22bbd9e863c10b675d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Notice that even though the \u201cinputs\u201d varied, all three hashes were still&nbsp;<strong>40 characters long<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this specific example, the fixed length is 40 characters long, which is determined by the specific&nbsp;<strong>funci\u00f3n hash<\/strong>&nbsp;used (\u201cSHA-1\u201d), which will be explained later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For now, just know that&nbsp;<em>other<\/em>&nbsp;hash functions may output different fixed lengths. Most have fixed lengths that are longer than 40 characters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A hash acts as a digital fingerprint.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A unique piece of data will always produce the same hash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you run \u201cHello\u201d a million times through a hash function, the above hash is what will appear a million times.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the word, \u201cHello\u201d, its SHA-1 hash will always be:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And only \u201cHello\u201d will ever produce that hash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any change to \u201cHello\u201d even if it\u2019s just changing it to \u201chello\u201d and the hash function will produce a&nbsp;<strong>totally different<\/strong>&nbsp;hash value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is why hashes are known as digital \u201c<strong>fingerprints<\/strong>\u201c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just like your fingerprint is unique to you, a hash is unique to a specific input of data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A hash can\u2019t be reversed.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The INPUT into a hash function is called a \u201c<strong>preimage<\/strong>\u201d But to keep things simple, I just stick with \u201cinput\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The OUTPUT of the hash function is called \u201c<strong>hash value<\/strong>\u201d o \u201c<strong>digest<\/strong>\u201d or simply as a \u201c<strong>hash<\/strong>\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A hash function is designed to act in a&nbsp;<strong>one-way manner<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since a hash function is a one-way function, the output, the \u201chash\u201d, can\u2019t be used to reveal the input, the \u201cpreimage\u201d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means that if all you see is the hash, you will NOT be able to decipher the original data (the \u201cpreimage\u201d) that the hash represents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Hash functions produce&nbsp;<strong>irreversible hashes.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Irreversible<\/strong>&nbsp;means that if you only had the hash you couldn\u2019t use that to figure out what the original piece of data was. This allows the original data to remain&nbsp;<strong>secure and unknown<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a hash function?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A&nbsp;<strong>funci\u00f3n hash<\/strong>&nbsp;is a&nbsp;<strong>mathematical operation<\/strong>&nbsp;that converts input data of&nbsp;<em>arbitrary<\/em>&nbsp;length into an output of&nbsp;<em>fixed<\/em>&nbsp;length that is executed using a certain&nbsp;<strong>algorithm<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">En&nbsp;<strong>algorithm<\/strong>&nbsp;is just a step-by-step set of instructions for performing calculations that are done by a software program.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It doesn\u2019t matter if the input is a single letter, a word, a full sentence, a page from a book, or an entire book, That\u2019s the&nbsp;<em>arbitrary<\/em>&nbsp;part.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each input will produce a unique output expressed as an alphanumeric string of&nbsp;<em>fixed<\/em>&nbsp;length.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Alphanumeric just means that something consists of both letters and numbers.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">A useful hash function&nbsp;<strong>conceals any clues about what the input may have looked like<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, it needs to be impossible to determine whether the input was long or short or contained numbers or letters. Also, changing just one character in the input should result in a radically different output.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Popular Hash Functions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">All hash functions work in a similar manner. You input data, and the hash function \u201cscrambles\u201d the data and outputs a hash.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common hash functions include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>MD-5:\u00a0<\/strong>Message Digest 5 (MD5) is a common hash function. In the past, it was considered secure but nowadays, hackers have discovered how to decode the algorithm and are able to do so in seconds.<\/li>\n\n\n\n<li><strong>SHA:\u00a0<\/strong>Secure Hash Algorithm (SHA) is another type of hash function. There are several variations of SHA grouped into four\u00a0<em>families<\/em>: SHA-0, SHA-1, SHA-2, and SHA-3: In general, the higher the number, the more recent the release and the more secure the algorithm.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For our purposes, the only hash function you need to know about right now is the&nbsp;<strong>Secure Hash Algorithm (SHA<\/strong>). More specifically, the SHA-2 family since it contains a special member in the family named&nbsp;<strong>SHA-256<\/strong>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">SHA-256 is a hash function that converts a string of text into another string that is always the same length: 64 alphanumeric characters long. This is equivalent to 256 bits, which is where the \u201c256\u201d in its name comes from.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s special because it\u2019s the hash function used in several parts of the Bitcoin system, which you\u2019ll learn about in later lessons. For now, it\u2019s important to just know that&nbsp;<strong>SHA-256 is a type of hash function and the one used by Bitcoin<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Whether the input is a page from a Harry Potter book or the&nbsp;<em>entire<\/em>&nbsp;series of Harry Potter books. the output of the SHA-265 hash function will always be the SAME length displayed as&nbsp;<strong>64 alphanumeric characters<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s now take a look at how hashing works in crypto.<\/p>","protected":false},"excerpt":{"rendered":"<p>Before diving into the subject of Bitcoin mining, we need to take a quick detour and learn about a certain concept that\u2019s foundational to cryptocurrencies. In order to truly understand how Bitcoin and other cryptocurrencies work, it\u2019s crucial to first understand the concept of \u201chashing\u201c. When you see the word, \u201chash\u201d, some folks might think [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,12],"tags":[],"class_list":["post-2799","post","type-post","status-publish","format-standard","hentry","category-beginners-guide-to-hashing","category-learn-crypto"],"_links":{"self":[{"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/posts\/2799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/comments?post=2799"}],"version-history":[{"count":1,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/posts\/2799\/revisions"}],"predecessor-version":[{"id":2800,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/posts\/2799\/revisions\/2800"}],"wp:attachment":[{"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/media?parent=2799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/categories?post=2799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apex-aiexperts.com\/es\/wp-json\/wp\/v2\/tags?post=2799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}