Finding collisions in SHA-256 on the Node.js platform using Bitcoin Hasher

Before starting reading, I want to warn you that all the definitions described below and the research I have done are for informational purposes only and are incomplete or inaccurate.





During the writing of this article, many important aspects have been omitted or not supplemented due to the magnitude of the topics that were covered. Based on the information I have provided, a list of materials will be given that can be consulted for a deeper dive into such sciences as data protection and cryptography.





To understand the operation of the Bitcoin Hasher application, the content of the article was divided into small sections:





  1. A bit of theory





  2. A little about SHA-2





  3. A little about Blockchain





  4. Bitcoin Hasher





  5. Useful materials





1. A bit of theory

, INPUT ( ) OUTPUT ( ). . (). , . , . :





, :









  1. hash-





  2. -









, . - . (x) "" (H) (y). (x) (H) (y) :





2. SHA-2

SHA-2 (Secure Hash Algorithm Version 2 - , 2).





, "", : SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/256 SHA-512/224 -, . , . , - . SHA-1 2002 . SHA-256, : Bitcoin Blockchain ( Blockchain ). .





, SHA-2:





SHA-224:       Hello World ! --> 2c8abaa6a94a76fe9c6005994567d67a1631bc90dfca267099dc750f
SHA-256:       Hello World ! --> 07f2bdef34ed16e3a1ba0dbb7e47b8fd981ce0ccb3e1bfe564d82c423cba7e47
SHA-384:       Hello World ! --> 67e60f9ce837caa3ca82550f0dfcbde1b8b8a7c1605fa8d115bcc2314204fd95f5f607306622c38c0205de7df6d426d8
SHA-512:       Hello World ! --> feab0028f1142d420a1425d1dd5b518225b4523aa1cff63385ece3411318819f5ec83042ccb79d81f20e4a243866886ca3ae3026153acff8e126c0e89631502e
SHA-512/256:   Hello World ! --> a70e1d1268e729e90db4c0834214f449c8e7b652777f40a8a0d26f2372e39ca7
SHA-512/224:   Hello World ! --> 7cc0d174b7ce522eff7d7ee59789e420d75d0244f006ef8ce0f4efb7
      
      



3. Blockchain

Blockchain SHA-256 , " " Bitcoin Hasher.





Blockchain - , , , .





, :





  1. (1991 ): Blockchain, . 1991 . Blockchain-.





  2. (1992 ): Blockchain , Blockchain.





  3. (2008 ): : "Bitcoin: a peer-to-peer electronic cash system". Blockchain Bitcoin.





  4. (2009 ): , , Blockchain Bitcoin.





, , , Blockchain , .





Blockchain , ( 685466, 2021-05-30 08:05):





{
      "hash": "00000000000000000009fde417c010d7ec9ffb25a268f4b0667681ed9b74cf65",       (   )
      "ver": 536870916,                                                                 ( )
      "prev_block": "00000000000000000007b7241ee4748769266870bdab4e5306379739db07c466"  (   ),
      "mrkl_root": "8d620000ab7ba942a165ed49be563a31c33269ce8f2d40b8317784475a543fe7"   (     ),
      "time": 1622351111                                                                (      ),
      "bits": 386752379                                                                 (- BTC),
      "nonce": 3069945434                                                               (       ),
      "n_tx": 996                                                                       (     ),
      "size": 1602081,                                                                  (  )
      "block_index": 685466                                                             (  ),
      "height": 685466                                                                  (  ),
      "tx": [
         "--Array of Transactions--"                                                    (   )
      ]
   }
      
      



, Blockchain, API.





Blockchain , . , , .





4. Bitcoin Hasher

Bitcoin Hasher SHA-256.





" " . Blockchain, SHA-256.





:





  1. JavaScript XHR- Blockchain API : https://blockchain.info/rawblock/ ( input ).





  2. Blockchain , Bitcoin Hasher , .





  3. "tx" "" Node.js .





  4. "prev_block" ( ) JavaScript XHR- : https://blockchain.info/rawblock/ ( ). .





  5. - INPUT-OUTPUT db_blocks/block-NUMBER_BLOCK.txt





  6. INPUT , OUTPUT .





Useful materials to familiarize yourself with the application:





Repository Bitcoin Hasher





An example of the formation of "double encryption", for a block with a height of 665862 in the Blockchain





Bitcoin Hasher workflow:





5. Useful materials

  1. Alferov A.P., Zubov A.Yu., Kuzmin A.S., Cheremushkin A.V. Fundamentals of Cryptography. M .: Helios ARV, 2001.479 p.





  2. Decentralized applications. Blockchain technology in action. S. Ravala





  3. Practical cryptography. Nils Ferguson and Bruce Schneier








All Articles