Bitcoin Forum
July 06, 2024, 04:19:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Understanding about Hash functions  (Read 133 times)
Insufficient (OP)
Member
**
Offline Offline

Activity: 231
Merit: 19


View Profile
July 20, 2018, 06:07:59 AM
 #1

Introduction
    Hash functions are the fundamental and vital part of the Blockchain . In summarize if you understand how the Hash functions work,  you'll understand too the Blockchain.

Hash Function What is it? Huh
  In the abstract, a Hash function is a mathematical process that takes input data of any size, performs an operation on it, and returns output data of a fixed size. In summarize , a hash function takes an input of any length and creates an output of fixed length.

  Hash function have a three basic characteristics :
  • Secure - Non-reversible function
  • Fixed size - short or long data will produce fixed-size digest
  • Unique - two different data sets cannot produce the same digest

How this relate to the blockchain? Huh
   Blockchain use hash functions everywhere : i.e In Bitcoin private key ; every public key linked to a private key , private key can generate an essentially unlimited supply of public addresses but you can not reverse it to show the secret key behind it.

r1s2g3
Sr. Member
****
Offline Offline

Activity: 742
Merit: 395


I am alive but in hibernation.


View Profile
July 21, 2018, 07:32:51 AM
 #2

How this relate to the blockchain? Huh
   Blockchain use hash functions everywhere : i.e In Bitcoin private key ; every public key linked to a private key , private key can generate an essentially unlimited supply of public addresses but you can not reverse it to show the secret key behind it.



I guess, this part is wrong, Private key is used to generate public key by  using elliptic curve multiplication. Bitcoin Address are generated by using Hash function on Public key.





source : https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04.asciidoc



  Hash function have a three basic characteristics :
  • Unique - two different data sets cannot produce the same digest


I do not have source but I remember to read that it is very rare scenarios but it is possible that 2 different input can have same hash.

I am alive
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
July 21, 2018, 09:46:48 AM
Merited by odolvlobo (1)
 #3

I do not have source but I remember to read that it is very rare scenarios but it is possible that 2 different input can have same hash.
You are indeed correct... this is known as a "collision". Refer: https://en.wikipedia.org/wiki/Collision_(computer_science)

Basically, it depends on the size of the output space for your hash function. The larger the space, the smaller the chance of a collision.

For example, if you have a 2 bit hash function (as opposed to bitcoins 256 bit hash functions)... then the only possible outputs of your hash function are:
Quote
00
01
10
11

Given any two different inputs... there is a 1/4 chance that they'll both generate the same output. A 256 bit hash function on the other hand has 2256 possible outputs... the odds of finding a collision are so small it is generally regarded as zero.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
vphasitha01
Full Member
***
Offline Offline

Activity: 196
Merit: 172


View Profile
July 21, 2018, 09:52:18 AM
 #4

I do not have source but I remember to read that it is very rare scenarios but it is possible that 2 different input can have same hash.
When we compare to the SHA-2 series of hash functions(SHA-256, SHA-384, SHA 512) has strong collision resistance. so it is hard to find two inputs having the same hash. I think you're talking about MD5 hash function which is vulnerable for collision attacks and also a hacker can produce two colliding hashes in no time with higher CPU power, but not with the SHA-2 series.

With SHA-256 function, almost all the time we cannot get Hash(A)=Hash(B) if A≠B


<...snip...>

I have created a thread regarding Hash function which I believed helpful for you Smiley. This Hash calculator is a very good one for reference with different hash functions.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!