{"id":9566,"date":"2023-02-12T14:56:50","date_gmt":"2023-02-12T14:56:50","guid":{"rendered":"https:\/\/www.bitnovo.com\/blog\/?p=9566"},"modified":"2025-09-10T15:24:22","modified_gmt":"2025-09-10T15:24:22","slug":"what-is-sha-256-algorithm-and-how-does-it-work","status":"publish","type":"post","link":"https:\/\/www.bitnovo.com\/blog\/en\/what-is-sha-256-algorithm-and-how-does-it-work","title":{"rendered":"What is SHA-256 algorithm and how does it work?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Alternar tabla de contenidos\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ffffff;color:#ffffff\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ffffff;color:#ffffff\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-sha-256-algorithm-and-how-does-it-work\/#origin_of_sha-256\" >Origin of SHA-256<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-sha-256-algorithm-and-how-does-it-work\/#how_does_the_sha-256_algorithm_work\" >How does the SHA-256 algorithm work?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-sha-256-algorithm-and-how-does-it-work\/#sha-256_and_bitcoin\" >SHA-256 and Bitcoin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-sha-256-algorithm-and-how-does-it-work\/#security_in_the_future\" >Security in the future<\/a><\/li><\/ul><\/nav><\/div>\n<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span><p>You have probably heard of the\u00a0<strong>SHA-256<\/strong>\u00a0acronym. These are found in the operation of\u00a0<strong>countless cryptocurrencies<\/strong>\u00a0due to the high level of security it can provide.<\/p>\n<p>In the technological world there are numerous systems for encrypting information, however, it could be said that the one that stands out the most is SHA-256. In short, it is an\u00a0<strong>algorithm<\/strong>\u00a0used in Bitcoin to\u00a0<strong>guarantee the security<\/strong>\u00a0of the information. Through this function, Bitcoin\u2019s\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-proof-of-work-the-bitcoin-consensus-protocol\/\">Proof of Work<\/a>\u00a0mechanisms are maintained.<\/p>\n<p>However, this is not the only function of SHA-256, as it is also used in the creation of addresses,\u00a0<strong>transaction<\/strong>\u00a0identifiers and\u00a0<strong>blocks<\/strong>. In this article we will look at\u00a0<strong>how SHA-256 works<\/strong>.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"origin_of_sha-256\"><\/span><strong>Origin of SHA-256<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The\u00a0<strong>SHA-256<\/strong>\u00a0function became known many years ago. It arose out of the Internet\u2019s need for a reliable and fast means of confirming data passing over the network.<\/p>\n<p>Before the creation of SHA-256 its task was performed by the function called\u00a0<strong>MD5<\/strong>. This function was characterized as being particularly simple in computational terms. Although it was the best alternative at the time, the\u00a0<strong>MD5 hash<\/strong>\u00a0function was categorized as\u00a0<strong>insecure<\/strong>\u00a0in\u00a0<strong>1996.<\/strong><\/p>\n<p>After several investigations, cryptanalyst\u00a0<strong>Hans Dobbertin<\/strong>\u00a0found a<strong>\u00a0security problem<\/strong>\u00a0in the MD5 hash function. Thus it was found how hackers, with the necessary\u00a0<strong>skill and resources<\/strong>, could\u00a0<strong>break the security algorithm<\/strong>\u00a0and thus leave communications on the Internet totally\u00a0<strong>vulnerable.<\/strong><\/p>\n<p>As expected, several institutions began to\u00a0<strong>look for solutions to this problem<\/strong>. Among them was<strong>\u00a0the US National Security Agency (NSA)<\/strong>. The NSA began to work on\u00a0<strong>the development of different hash functions<\/strong>\u00a0capable of replacing the\u00a0<strong>MD5<\/strong>\u00a0function. However, the first\u00a0<strong>SHA protocol<\/strong>\u00a0known as\u00a0<strong>SHA-0<\/strong>\u00a0was released in\u00a0<strong>1993<\/strong>. Research continued and\u00a0<strong>two years later<\/strong>\u00a0the\u00a0<strong>SHA-1<\/strong>\u00a0function was created, an improved version in terms of strength.<\/p>\n<p>By\u00a0<strong>2001<\/strong>, the NSA submitted to the U.S. National Institute of Standards and Technology (NIST) the SHA-2 function set. (NIST) the\u00a0<strong>SHA-2<\/strong>\u00a0function set. This set of functions included the following:\u00a0<strong>SHA-224, SHA-256, SHA-384 and SHA-512.<\/strong><\/p>\n<p>Subsequently these functions were recognized as a\u00a0<strong>Federal Information Processing Standard (FIPS),<\/strong>\u00a0under the identification FIPS PUB 180-4. At this point the SHA-256 function became an essential function for the IT world. The properties that make it so special range from security to\u00a0<strong>speed of calculation<\/strong>. Within a short time its use began to spread to server software and applications where\u00a0<strong>robust and secure<\/strong>\u00a0functions were needed to ensure data\u00a0<strong>integrity<\/strong>.<\/p>\n<div id=\"image_315328881\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img fetchpriority=\"high\" decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu%C3%A9-es-y-c%C3%B3mo-funciona-el-algoritmo-SHA-256.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256-300x205.jpg 300w\" alt=\"Qu\u00e9 es y c\u00f3mo funciona el algoritmo SHA-256\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/P-Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"how_does_the_sha-256_algorithm_work\"><\/span><strong>How does the SHA-256 algorithm work?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To understand how the SHA-256 function works we must first look at its main\u00a0<strong>features<\/strong>. The first thing to keep in mind is that an\u00a0<strong>SHA-256<\/strong>\u00a0algorithm works in a\u00a0<strong>unidirectional<\/strong>\u00a0<strong>way<\/strong>. This feature means that from<strong>\u00a0any data<\/strong>\u00a0we can generate a hash, however, we cannot\u00a0<strong>generate the content<\/strong>\u00a0of the\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-a-hash\/\">Hash<\/a>\u00a0from it.<\/p>\n<p>There are countless ways to create\u00a0<strong>Hashes<\/strong>, however,\u00a0<strong>SHA-256<\/strong>\u00a0is one of the most widely\u00a0<strong>used<\/strong>\u00a0due to its<strong>\u00a0security and balance<\/strong>\u00a0of computational cost of generation. It is worth noting that with SHA-256 the length of the result is\u00a0<strong>always the same<\/strong>\u00a0no matter how long the content by which\u00a0<strong>the Hash<\/strong>\u00a0is generated is. The result of a\u00a0<strong>5 word sentence or a 200 page book<\/strong>\u00a0will always be a combined string of<strong>\u00a064 letters<\/strong>\u00a0<strong>and numbers<\/strong>. Its encoding is\u00a0<strong>256 bytes, 34 bytes.<\/strong><\/p>\n<p>Focusing on how SHA-256 works, its security is based on building a series of\u00a0<strong>cryptographic functions<\/strong>. These are the so-called<strong>\u00a0Merkle-Damgard and Ivan Damgard<\/strong>\u00a0Hash functions created in\u00a0<strong>1979<\/strong>. They used a one-way understanding of the<strong>\u00a0Davies-Meyer<\/strong>\u00a0type. By means of these methods, they sought to\u00a0<strong>guarantee resistance<\/strong>\u00a0to repeated hashes and greater\u00a0<strong>security<\/strong>\u00a0for the function.<\/p>\n<p>Thus, the\u00a0<strong>SHA-256<\/strong>\u00a0function was created as a function for\u00a0<strong>entering data<\/strong>\u00a0and achieving a\u00a0<strong>summary<\/strong>\u00a0of the information with a fixed measurement. This system guarantees what we call\u00a0<strong>avalanche effect<\/strong>. This means that the slightest change in the information of the function will generate a Hash totally\u00a0<strong>different<\/strong>\u00a0from the initial one. However, if we submit the same sentence to the Hash process we will obtain\u00a0<strong>the same result<\/strong>\u00a0every time, since the process is\u00a0<strong>deterministic<\/strong>.<\/p>\n<div class=\"is-divider divider clearfix\"><\/div>\n<div id=\"image_1022990203\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu%C3%A9-es-y-c%C3%B3mo-funciona-el-algoritmo-SHA-256.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256-300x205.jpg 300w\" alt=\"Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2021\/06\/1Qu\u00e9-es-y-c\u00f3mo-funciona-el-algoritmo-SHA-256.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"sha-256_and_bitcoin\"><\/span><strong>SHA-256 and Bitcoin<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The security provided by this system makes it one of the most attractive for its\u00a0<strong>application<\/strong>\u00a0in cryptocurrencies such as Bitcoin. Since its inception in\u00a0<strong>2009<\/strong>, Satoshi made Bitcoin known by highlighting the use of this function. In fact, practically all its security is based on SHA-256.<\/p>\n<p>In order to implement SHA-256, Satoshi Nakamoto created\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-proof-of-work-the-bitcoin-consensus-protocol\/\">PoW<\/a>. Bitcoin miners must therefore solve complex cryptographic puzzles that lead to the use of this function.<\/p>\n<p>To achieve mining, miners must accumulate SHA-256 hashes until they find a decimal value less than the target value requested in the network, which is not an easy task. In addition, the system regulates the mining difficulty by increasing or decreasing it and thereby varies the power of the network to calculate SHA-256 hashes. In other words,\u00a0<strong>the higher the power of the network, the more difficult the mining job will be<\/strong>\u00a0and thus the more difficult it will be to achieve\u00a0<strong>the correct hash<\/strong>.<\/p>\n<p>All this process is summarized in a single result called\u00a0<strong>Block Hash or Block ID<\/strong>, a\u00a0<strong>unique<\/strong>\u00a0and unrepeatable identifier that we find in each Bitcoin block. It is given in the form of a Hash and it is clearly\u00a0<strong>SHA-256<\/strong>.<\/p>\n<p>It is worth noting that Bitcoin is not the only project to use SHA-256. In fact, most cryptocurrency\u00a0<strong>projects<\/strong>\u00a0created from Bitcoin use it. Even\u00a0<strong>independent<\/strong>\u00a0Bitcoin projects. The reason is clear, a\u00a0<strong>secure, easy<\/strong>\u00a0to implement and\u00a0<strong>reliable<\/strong>\u00a0standard. The list of cryptocurrencies that use it is not short, however below we will see some of those that use SHA-256 in their mining:\u00a0<strong><a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-bitcoin-cash-bch\/\">Bitcoin Cash<\/a>,\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-namecoin\/\">Namecoin<\/a>, Peercoin or\u00a0<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-mine-steem-steem\/\">Steem<\/a>\u00a0Dollars.<\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"security_in_the_future\"><\/span><strong>Security in the future<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With the advancement of technologies many users wonder how\u00a0<strong>secure<\/strong>\u00a0a function created in\u00a0<strong>2001<\/strong>\u00a0will be in the future. There are currently known ways of attack that would\u00a0<strong>break<\/strong>\u00a0the security of SHA-256, however,\u00a0<strong>none<\/strong>\u00a0of them could be\u00a0<strong>applied<\/strong>\u00a0so far.<\/p>\n<p>All of this leads us to believe that SHA-256 may not be as secure, but it will be for quite some<strong>\u00a0time<\/strong>. In case it is breached at some point, SHA-256 would only have to be\u00a0<strong>updated<\/strong>\u00a0and the\u00a0<strong>mining processes<\/strong>\u00a0as well as the\u00a0<strong>identifier generation<\/strong>\u00a0processes would have to be updated. This coupled with\u00a0<strong>updating the addresses<\/strong>\u00a0would be enough to circumvent the problem and keep cryptocurrencies in a\u00a0<strong>secure field<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span>You have probably heard of the\u00a0SHA-256\u00a0acronym. These are found in the operation of\u00a0countless cryptocurrencies\u00a0due to the high level of security it can provide. In the technological world there are numerous systems for encrypting information, however, it could be said that the one that stands out the most is SHA-256. In short, it is an\u00a0algorithm\u00a0used in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":9568,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185],"tags":[],"class_list":["post-9566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain-en"],"_links":{"self":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/9566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/comments?post=9566"}],"version-history":[{"count":2,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/9566\/revisions"}],"predecessor-version":[{"id":24728,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/9566\/revisions\/24728"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media\/9568"}],"wp:attachment":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media?parent=9566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/categories?post=9566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/tags?post=9566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}