Bitcoin Forum
April 25, 2024, 11:24:10 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: 'Hash function' explained simply for Beginners ( + Hash calculator)  (Read 148 times)
vphasitha01 (OP)
Full Member
***
Offline Offline

Activity: 196
Merit: 172


View Profile
July 06, 2018, 04:09:44 PM
Last edit: July 07, 2018, 02:18:44 AM by vphasitha01
 #1


Hash


Every block in a block chain has a hash. It's like a finger print. We can say cryptographic hash is like a signature for a text or data file. It identify the block and all it's content and it's always unique just as like fingerprint. Once a block is created it's hash is calculated. Changing something(data) inside the block will cause hash to change, in other other words we can say hashes are very useful when you want to detect changes in the block.


Hashing function


I think it's the most important mathematical operation used in Bitcoin network. It needs for proof of work. We can say it's some kind of mathematical transformation of data. We can select some inputs and transform those inputs into a 64 characters long number. In fact some of them are letters and numerical digits in hexadecimal[1]. We can input limitless inputs through this mathematical system and can get a output number ( 64 characters long). If we even change small thing, just imagine changing one lowercase in to upper case in a single character in a input, it will ultimately change the whole output number completely. So no one can predict the output from what the given in input.


SHA-256


SHA(Secure Hash Algorithm) is one of a cryptographic hash functions which known as one of the strongest hash functions available. SHA-256 algorithm generates an almost unique, fixed size 256 bit hash. We can call hash as one way function so it cannot be decrypted back. Therefore it's more suitable for password validation, anti-tamper, digital signatures.


SHA-256 Calculator


This is the link >>> "+++hash calculator+++".

Just type whatever you like. So I will type my Bitcointalk username as "vphasitha01" and you can see the resulting hash at the bottom.


If I change one lowercase character ( say "v") into a uppercase character (say"V"), the resulting hash changes completely and just has no resemblance to what happens before.


So let's put some Bitcoin transactions as follows,

Code:
James ->5btc for Alex
Hari ->0.5 btc for Devon
Clair ->1.256 btc Jack

and below that we can input some random number, nonsense number. In fact in Bitcoin network we called as "nonce".

Then we change this number with objective to get the output hash starting with zero. So keep changing until we get the starting number as zero. So using this "nonce" we can able to get hash which stats from zero.


This is actually what Bitcoin miners are doing. They are trying to take their transactions and tries to find the right "nonce". So with those transactions they gets the hash which starts with zeros. In Bitcoin case it's more than one zero it's something like 19 zeros as time of writing. So it will take very long time to even for few zeros. 19 zeros? You will never would be able to do it by your own. There are special hardwares to do this process quickly called as "ASICs" (Application Specific Integrated Circuit chips).

Bitcoin network is calibrated to only miner within the span of ten minutes will be able to find the right hashes with 19 zeros. That gives them the ability to announce their transactions with reference to the Bitcoin network. They actually packaged them into a block with the "nonce" and sent it out to across the network. All the other miners verify for himself. So transaction is valid and has a appropriate hash and add up that block to the chain of blocks to the block chain and that's how blocks grows in the network. This is known as " Proof of Work" ,they proving that doing some work to create a block which leads to consensus.



[1] - It uses sixteen distinct symbols,most often the symbols 0-9 to represent the values zero to nine, and A-F to represent values ten to fifteen.
Link 1>>>https://www.xorbin.com/tools/sha256-hash-calculator
Link 2>>>https://en.m.wikipedia.org/wiki/Hexadecimal
1714044250
Hero Member
*
Offline Offline

Posts: 1714044250

View Profile Personal Message (Offline)

Ignore
1714044250
Reply with quote  #2

1714044250
Report to moderator
1714044250
Hero Member
*
Offline Offline

Posts: 1714044250

View Profile Personal Message (Offline)

Ignore
1714044250
Reply with quote  #2

1714044250
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10498



View Profile
July 07, 2018, 04:01:37 AM
 #2

This is the link >>> http://passwordsgenerator.net/sha256-hash-generator

Just type whatever you like. So I will type my Bitcointalk username as "vphasitha01" and you can see the resulting hash at the bottom.

just remember that using this tool you are hashing a string and you can not tell it that an input you are using in this is a hex. i have seen in the past people got confused about why this tool doesn't give them the same result as it should.
for instance if you use it on raw transaction hex:
https://blockchain.info/rawtx/b172a723e0e517f756e2565375004ac72cb45b496ef26b81f91d27ef3d776bfc?format=hex
you will get DDE9AACFB7F34EAB16885EA80BD28EF47C5D79CF05659F390B160BC16C8384D5 (double sha) instead of the transaction ID which is b172a723e0e517f756e2565375004ac72cb45b496ef26b81f91d27ef3d776bfc

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
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!