Skip to content

Commit

Permalink
Merge pull request #113 from neo-project/Update-hash_algorithm.md
Browse files Browse the repository at this point in the history
Update hash_algorithm.md
  • Loading branch information
Celia18305 authored May 27, 2024
2 parents bfdaf7f + afb370f commit 21d42da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/n3/foundation/Cryptography/hash_algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hash function, or hash algorithm, is a method creating digital finger print from any kind of data. Hash function compresses message or data into a digested version to shrink the data into a fixed data size. This function disorganizes and remixes data, rebuilding a data fingerprint as a hash value. Hash value is always represented by a short string consisting of random letters and digits.

Two different hash functions are used widely in the Neo system: SHA256 and RIPEMD160. The former is used to generate a longer hash value (32 bytes) and the latter is used to generate a shorter hash value (20 bytes). Usually when a hash value of an object is generated, hash functions are used twice. For example, when a hash of a block or transaction is generated, SHA256 is calculated twice; when a contract address is generated, the SHA256 hash of the script is calculated, then the NSPEMD160 hash of the previous hash is calculated.
Two different hash functions are used widely in the Neo system: SHA256 and RIPEMD160. The former is used to generate a longer hash value (32 bytes) and the latter is used to generate a shorter hash value (20 bytes). Usually when a hash value of an object is generated, hash functions are used twice. For example, when a hash of a block or transaction is generated, SHA256 is calculated twice; when a contract address is generated, the SHA256 hash of the script is calculated, then the RIPEMD160 hash of the previous hash is calculated.

In addition, the block will also use a hash structure called a Merkle Tree. It computes the hash of each transaction and combines one with the next and then hashes again, repeating this process until there is only one root hash (Merkle Root).

Expand Down

0 comments on commit 21d42da

Please sign in to comment.