Cryptopedia
Hash Algorithm
A hash is a value computed from a base input number using a hashing function. The hash algorithm plays an important role in the blockchain technology. The one-way hash function, a scattering function, converts a variable-length input into a fixed-length binary sequence. However, this process is irreversible. The hash value generated after hashing varies a lot although the inputs have small differences. That’s why the hash algorithm is suitable for encryption.
For instance, hashed by SHA1, the sequences of Gate and Gate1 are different despite their fixed length:
5701b5f6feaa9aaae618dd553adc29893963cc1a;
b3607aef90d33224f0ab1b2663407af3571e4798;
There are numerous types of the hash algorithm. Generally speaking, a longer length of sequence means stronger security. SHA256, SHA1, and MD5 are common hash algorithms. As for Bitcoin, SHA256 is applied in its network.
Main Applications of the Hash Algorithm in the Bitcoin Network:
1. Generating the Address of a Node
The address of a node is similar to the number of a bank card. Bitcoins are transferred through addresses.
To generate an address, a public key is run through both the SHA256 hashing algorithm and the RIPEMD160 hashing algorithm repeatedly, before encoding it with BASE58.
2. Mining
Bitcoin is mined through a proof-of-work consensus algorithm, which involves hashing. First, a block header is hashed repeatedly by miners by altering the nonce value. Through this process, miners can produce the target hash value, completing a proof of work.
3. Merkle Tree
A Merkle tree is one of the important information stored in the block header. The root hash of a Merkle tree is the hash of all the hashes of all the transaction data in a block. In a block header, its components include the Merkle root hash, the hash of the previous block, the version number of the software, the timestamp, the bits, and the nonce.
Besides what has mentioned above, the hash algorithm is applied in many other ways in the blockchain network, such as forming a blockchain. The algorithm is central to the protection and transmission of transaction data in a block.
For instance, hashed by SHA1, the sequences of Gate and Gate1 are different despite their fixed length:
5701b5f6feaa9aaae618dd553adc29893963cc1a;
b3607aef90d33224f0ab1b2663407af3571e4798;
There are numerous types of the hash algorithm. Generally speaking, a longer length of sequence means stronger security. SHA256, SHA1, and MD5 are common hash algorithms. As for Bitcoin, SHA256 is applied in its network.
Main Applications of the Hash Algorithm in the Bitcoin Network:
1. Generating the Address of a Node
The address of a node is similar to the number of a bank card. Bitcoins are transferred through addresses.
To generate an address, a public key is run through both the SHA256 hashing algorithm and the RIPEMD160 hashing algorithm repeatedly, before encoding it with BASE58.
2. Mining
Bitcoin is mined through a proof-of-work consensus algorithm, which involves hashing. First, a block header is hashed repeatedly by miners by altering the nonce value. Through this process, miners can produce the target hash value, completing a proof of work.
3. Merkle Tree
A Merkle tree is one of the important information stored in the block header. The root hash of a Merkle tree is the hash of all the hashes of all the transaction data in a block. In a block header, its components include the Merkle root hash, the hash of the previous block, the version number of the software, the timestamp, the bits, and the nonce.
Besides what has mentioned above, the hash algorithm is applied in many other ways in the blockchain network, such as forming a blockchain. The algorithm is central to the protection and transmission of transaction data in a block.