{"id":4782,"date":"2023-01-19T05:42:42","date_gmt":"2023-01-19T05:42:42","guid":{"rendered":"https:\/\/metaschool.so\/articles\/?p=4782"},"modified":"2023-08-31T09:30:31","modified_gmt":"2023-08-31T09:30:31","slug":"hashing-in-blockchain","status":"publish","type":"post","link":"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/","title":{"rendered":"Complete Guide to Hashing in Blockchain for 2023"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_56_1 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Introduction_to_hashing_in_blockchain_and_its_importance\" title=\"Introduction to hashing in blockchain and its importance\">Introduction to hashing in blockchain and its importance<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Key_functions_of_hashing\" title=\"Key functions of hashing \">Key functions of hashing <\/a><ul class='ez-toc-list-level-4'><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#1_Security\" title=\"1. Security\">1. Security<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#2_Verification\" title=\"2. Verification\">2. Verification<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#3_Pointers\" title=\"3. Pointers\">3. Pointers<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#4_Consensus_mechanism\" title=\"4. Consensus mechanism\">4. Consensus mechanism<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#How_does_hashing_generally_work\" title=\"How does hashing generally work?\">How does hashing generally work?<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#1_Input_is_processed_by_the_hashing_algorithm\" title=\"1. Input is processed by the hashing algorithm\">1. Input is processed by the hashing algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#2_A_hash_output_serves_as_a_digital_footprint_of_the_input\" title=\"2. A hash output serves as a digital footprint of the input\">2. A hash output serves as a digital footprint of the input<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#3_The_hash_is_stored_in_the_block_and_serves_as_a_digital_signature\" title=\"3. The hash is stored in the block and serves as a digital signature\">3. The hash is stored in the block and serves as a digital signature<\/a><ul class='ez-toc-list-level-4'><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Moreover_hashing_algorithms_can_also_secure_data_in_other_ways\" title=\"Moreover, hashing algorithms can also secure data in other ways\">Moreover, hashing algorithms can also secure data in other ways<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Common_hashing_algorithms_in_blockchain\" title=\"Common hashing algorithms in blockchain\">Common hashing algorithms in blockchain<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#1_SHA-256_Secure_Hash_Algorithm_256-bit\" title=\"1. SHA-256 (Secure Hash Algorithm 256-bit)\">1. SHA-256 (Secure Hash Algorithm 256-bit)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#2_Scrypt\" title=\"2. Scrypt\">2. Scrypt<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#3_Ethash\" title=\"3. Ethash\">3. Ethash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#4_Equihash\" title=\"4. Equihash\">4. Equihash<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Whats_the_process_of_solving_a_hash\" title=\"What&#8217;s the process of solving a hash? \">What&#8217;s the process of solving a hash? <\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Solving_a_hash_typically_involves_these_steps\" title=\"Solving a hash typically involves these steps\">Solving a hash typically involves these steps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#The_relationship_of_PoW_and_hashing_in_blockchain\" title=\"The relationship of PoW and hashing in blockchain\">The relationship of PoW and hashing in blockchain<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#Cryptographic_hash_function_properties_explained\" title=\"Cryptographic hash function properties, explained\">Cryptographic hash function properties, explained<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#1_Deterministic\" title=\"1. Deterministic\">1. Deterministic<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#2_Preimage_resistance\" title=\"2. Preimage resistance\">2. Preimage resistance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#3_Collision_resistance\" title=\"3. Collision resistance\">3. Collision resistance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#4_Fast_computation\" title=\"4. Fast computation\">4. Fast computation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#5_Output_size\" title=\"5. Output size\">5. Output size<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#6_Avalanche_effect\" title=\"6. Avalanche effect\">6. Avalanche effect<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/metaschool.so\/articles\/hashing-in-blockchain\/#7_Randomness\" title=\"7. Randomness\">7. Randomness<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p>A hashing algorithm in blockchain is a mathematical function that takes an input (or &#8220;message&#8221;), and returns a fixed-size string of characters, known as the &#8220;hash.&#8221; <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction-to-hashing-in-blockchain-and-its-importance\"><span class=\"ez-toc-section\" id=\"Introduction_to_hashing_in_blockchain_and_its_importance\"><\/span>Introduction to hashing in blockchain and its importance<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The process of applying a hashing algorithm to an input is known as &#8220;hashing.&#8221; In the context of blockchain, the input is typically the data stored in a block, and the output is the hash that is stored in that block.<\/p>\n\n\n\n<p>Hashing is an essential aspect of <a href=\"https:\/\/metaschool.so\/articles\/what-is-blockchain-guide\/\">blockchain technology<\/a>, and it plays several key roles in helping to ensure the security and integrity of the blockchain. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"key-functions-of-hashing\"><span class=\"ez-toc-section\" id=\"Key_functions_of_hashing\"><\/span>Key functions of hashing <span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1-security\"><span class=\"ez-toc-section\" id=\"1_Security\"><\/span>1. Security<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Hashes are one-way functions, meaning that it is very difficult to determine the original input (or &#8220;message&#8221;) from the hash. This makes it difficult for someone to alter the contents of a block without being detected, since any changes to the <a href=\"https:\/\/metaschool.so\/articles\/block-meaning-blockchain\/\">block<\/a> will result in a different hash. <\/p>\n\n\n\n<p>In this way, the use of hashing ensures that the integrity of the data stored in the blockchain is maintained, and it makes it difficult for an attacker to tamper with the data.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2-verification\"><span class=\"ez-toc-section\" id=\"2_Verification\"><\/span>2. Verification<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Hashes are used to verify the integrity of data stored in a blockchain. By comparing the hash of a block to the hash stored in the block that comes after it, one can confirm that the contents of the block have not been tampered with. <\/p>\n\n\n\n<p>For example, In the Bitcoin blockchain, each block contains the hash of the previous block, this link between the blocks ensures that any alteration to the previous block will make the hash of the current block invalid and the network will reject it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"3-pointers\"><span class=\"ez-toc-section\" id=\"3_Pointers\"><\/span>3. Pointers<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Hashes can be used as pointers to specific blocks in a blockchain. For example, the hash of a block can be stored in the block that comes after it, linking the two blocks together. This forms the basis of how blocks are linked together in a blockchain.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"4-consensus-mechanism\"><span class=\"ez-toc-section\" id=\"4_Consensus_mechanism\"><\/span>4. Consensus mechanism<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Proof-of-work consensus mechanism, used by several blockchain networks, is dependent on the ability of miners to solve the hash function associated with a block, this difficulty level of solving the hash is adjusted to control the rate at which new blocks are added to the blockchain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-does-hashing-generally-work\"><span class=\"ez-toc-section\" id=\"How_does_hashing_generally_work\"><\/span>How does hashing generally work?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The basic steps of the process are as follows:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-input-is-processed-by-the-hashing-algorithm\"><span class=\"ez-toc-section\" id=\"1_Input_is_processed_by_the_hashing_algorithm\"><\/span>1. Input is processed by the hashing algorithm<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The process of hashing begins with the input, or the data that needs to be hashed. This data can be any kind of information, such as a string of text, a file, or a block of transactions in a blockchain. The input is then passed through the hashing algorithm.<\/p>\n\n\n\n<p>The algorithm applies a set of mathematical rules and operations to the input, such as mathematical transformations, bitwise operations, and logical operations<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-a-hash-output-serves-as-a-digital-footprint-of-the-input\"><span class=\"ez-toc-section\" id=\"2_A_hash_output_serves_as_a_digital_footprint_of_the_input\"><\/span>2. A hash output serves as a digital footprint of the input<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The output of the hashing algorithm is the hash, which serves as a digital fingerprint of the input. This hash is a unique representation of the input and typically a string of characters, such as a hexadecimal number, that is a fixed size, depending on the algorithm used.<\/p>\n\n\n\n<p>The key feature of a hashing algorithm is that it is a one-way function, meaning that it is very difficult to determine the original input from the hash. This makes it difficult for someone to alter the contents of a block without being detected, since any changes to the block will result in a different hash.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-the-hash-is-stored-in-the-block-and-serves-as-a-digital-signature\"><span class=\"ez-toc-section\" id=\"3_The_hash_is_stored_in_the_block_and_serves_as_a_digital_signature\"><\/span>3. The hash is stored in the block and serves as a digital signature<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It is stored in the block along with the data, and it serves as a digital signature that proves the integrity of the data. When the data is needed in the future, the hash can be recalculated, and if it matches the stored hash, it is confirmed that the data has not been tampered with.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"moreover-hashing-algorithms-can-also-secure-data-in-other-ways\"><span class=\"ez-toc-section\" id=\"Moreover_hashing_algorithms_can_also_secure_data_in_other_ways\"><\/span>Moreover, hashing algorithms can also secure data in other ways<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Yep, they are also used to secure data in other ways, for example, in password authentication systems. In this case, the password entered by the user is hashed and compared to the stored hash of the correct password. If the hashes match, the user is granted access.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"common-hashing-algorithms-in-blockchain\"><span class=\"ez-toc-section\" id=\"Common_hashing_algorithms_in_blockchain\"><\/span>Common hashing algorithms in blockchain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are several different hashing algorithms that can be used in blockchain, each with its own unique properties. Some of the most commonly used hashing algorithms in blockchain include:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-sha-256-secure-hash-algorithm-256-bit\"><span class=\"ez-toc-section\" id=\"1_SHA-256_Secure_Hash_Algorithm_256-bit\"><\/span>1. SHA-256 (Secure Hash Algorithm 256-bit)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This is a widely used hashing algorithm that was first introduced by the National Security Agency (NSA) in 2001. It produces a 256-bit hash, which is a 64-character string of hexadecimal characters. SHA-256 is considered to be a very secure algorithm, and is used in several cryptocurrencies, including <a href=\"https:\/\/metaschool.so\/blockchains\/bitcoin?ref=Articles&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">Bitcoin<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-scrypt\"><span class=\"ez-toc-section\" id=\"2_Scrypt\"><\/span>2. Scrypt<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This is a password-based key derivation function that was designed to be more memory-intensive than other hashing algorithms in order to make it more resistant to specialized hardware attacks. Scrypt is used in several cryptocurrencies, including Litecoin.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-ethash\"><span class=\"ez-toc-section\" id=\"3_Ethash\"><\/span>3. Ethash<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This is a memory-hard hashing algorithm that was specifically designed for use in the <a href=\"https:\/\/metaschool.so\/blockchains\/ethereum?ref=Articles&amp;utm_source=Blog_Organic\" target=\"_blank\" rel=\"noreferrer noopener\">Ethereum blockchain<\/a>. It is designed to be resistant to Application-Specific Integrated Circuit (ASIC) miners, which are specialized devices that are designed to perform a specific task, such as mining for cryptocurrency.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-equihash\"><span class=\"ez-toc-section\" id=\"4_Equihash\"><\/span>4. Equihash<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This is a memory-bound hashing algorithm that was designed to be resistant to ASIC miners. It is used in several cryptocurrencies, including <a href=\"https:\/\/z.cash\/\" target=\"_blank\" rel=\"noreferrer noopener\">Zcash<\/a>.<\/p>\n\n\n\n<p>To conclude this section, each of these algorithms works differently and has its own unique properties. But they all have one thing in common: they take an input (or &#8220;message&#8221;) and produce a fixed-size string of characters (or &#8220;hash&#8221;) that serves as a digital fingerprint of the input.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-s-the-process-of-solving-a-hash\"><span class=\"ez-toc-section\" id=\"Whats_the_process_of_solving_a_hash\"><\/span>What&#8217;s the process of solving a hash? <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Solving a hash in blockchain typically refers to the process of mining, which is the process of creating new blocks and adding them to the blockchain. This process is done by miners, who use specialized software and hardware to perform complex mathematical calculations in order to find a solution to the hash function.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"solving-a-hash-typically-involves-these-steps\"><span class=\"ez-toc-section\" id=\"Solving_a_hash_typically_involves_these_steps\"><\/span>Solving a hash typically involves these steps<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>A new block is created with a set of pending transactions.<\/li><li>The miner takes the data from the new block, along with the hash of the previous block, and applies the hash function to it.<\/li><li>The miner then repeatedly modifies a small piece of data, called a nonce, until the hash of the block meets certain criteria.<\/li><li>The miner then submits the solution, along with the block data, to the network to <a href=\"https:\/\/metaschool.so\/articles\/validator-blockchain\/\">validate<\/a>.<\/li><li>Once the solution is validated by the network, the new block is added to the blockchain, and the miner is rewarded with a certain number of cryptocurrency.<\/li><\/ol>\n\n\n\n<p>The process of mining is designed to be difficult. Miners must compete against each other to find the solution to the hash function, and the first miner to find a valid solution is rewarded with cryptocurrency. This is known as the &#8220;<a href=\"https:\/\/metaschool.so\/articles\/proof-of-work-meaning\/\">proof-of-work<\/a>&#8221; consensus mechanism, used by Bitcoin and other similar blockchain networks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"the-relationship-of-pow-and-hashing-in-blockchain\"><span class=\"ez-toc-section\" id=\"The_relationship_of_PoW_and_hashing_in_blockchain\"><\/span>The relationship of PoW and hashing in blockchain<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The relationship between PoW and hashing is that hashing is the mechanism that enables PoW to function. <\/p>\n\n\n\n<p>Hashing is used to secure the data stored in the blockchain and to validate the integrity of the data. Miners use their computational power to perform complex mathematical calculations in order to find a solution to the hash function and add a new block to the blockchain. <\/p>\n\n\n\n<p>The difficulty level of solving the hash function is adjusted to control the rate at which new blocks are added to the blockchain. This creates an economic incentive for miners to participate in the network and to secure it by performing the necessary computational work.<\/p>\n\n\n\n<p>And while it is a complex process that requires significant computational power, it is also a crucial step in ensuring the security of the blockchain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cryptographic-hash-function-properties-explained\"><span class=\"ez-toc-section\" id=\"Cryptographic_hash_function_properties_explained\"><\/span>Cryptographic hash function properties, explained<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Cryptographic hash functions are a type of hashing algorithm that are designed to have certain properties that make them suitable for use in cryptographic applications, such as digital signatures, message authentication, and password hashing. <\/p>\n\n\n\n<p>Some of the key properties of cryptographic hash functions include:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-deterministic\"><span class=\"ez-toc-section\" id=\"1_Deterministic\"><\/span>1. Deterministic<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This property means that for any given input, the output (or hash) will always be the same. This means that the same message will always produce the same hash, and different messages will always produce different hashes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-preimage-resistance\"><span class=\"ez-toc-section\" id=\"2_Preimage_resistance\"><\/span>2. Preimage resistance<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This property means that it is computationally infeasible to determine the input (or message) that produced a given hash. This makes it difficult for an attacker to alter the contents of a block or message without being detected, since any changes to the input will result in a different hash.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-collision-resistance\"><span class=\"ez-toc-section\" id=\"3_Collision_resistance\"><\/span>3. Collision resistance<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This property means that it is computationally infeasible to find two different inputs (or messages) that produce the same hash. This ensures that the hash of a message is unique and can be used as a digital signature for the message.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-fast-computation\"><span class=\"ez-toc-section\" id=\"4_Fast_computation\"><\/span>4. Fast computation<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The hash function should be fast in terms of computation, as it needs to be calculated for each new block in the blockchain, and also it needs to be verified in each transaction.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-output-size\"><span class=\"ez-toc-section\" id=\"5_Output_size\"><\/span>5. Output size<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The output size of the hash function should be of a fixed size, this makes it easier to compare and store the hash values.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6-avalanche-effect\"><span class=\"ez-toc-section\" id=\"6_Avalanche_effect\"><\/span>6. Avalanche effect<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This property means that a small change in the input should result in a completely different hash, this property is important for security purposes as it makes it difficult for an attacker to make slight changes to the input without being detected.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7-randomness\"><span class=\"ez-toc-section\" id=\"7_Randomness\"><\/span>7. Randomness<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The hash output should be random, this property is important for security purposes as it makes it difficult for an attacker to predict the output of the hash function.<\/p>\n\n\n\n<p><strong>Finally, <\/strong><\/p>\n\n\n\n<p>Hashing plays a crucial role in blockchain technology by providing a way to secure the data stored in the blockchain, verify the integrity of the data, link blocks together, and serve as a part of the consensus mechanism. Without hashing, the blockchain would not be able to function as a secure, tamper-proof, and decentralized <a href=\"https:\/\/metaschool.so\/articles\/blockchain-ledger-meaning\/\">ledger<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":6,"featured_media":4786,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[17],"tags":[],"class_list":["post-4782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain"],"_links":{"self":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/comments?post=4782"}],"version-history":[{"count":8,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4782\/revisions"}],"predecessor-version":[{"id":6774,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/4782\/revisions\/6774"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media\/4786"}],"wp:attachment":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media?parent=4782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/categories?post=4782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/tags?post=4782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}