Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 03, 2018, 02:27:13 PM |
|
Hi all,
Can someone explain me SHA 256 step by step mathematical operation taking an example,i want to know each step from conversion of word to ASCII code and binary code ,later right shift and all those stuffs till i get a hash.
And i have another question why bitcoin uses double SHA256,and how does double SHA 256 compared to normal SHA256 exactly work?
I want to be a blockchain developer so i need to learn all these from scratch.
Thank you
|
|
|
|
TheArchaeologist
|
If you are looking for detailed information on the SHA-256 algorithm I suggest you read the document on Secure Hash Standard (SHS) here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf That's a 36 page PDF so a bit too long to reproduce here. Regarding your question on double SHA-256 and how it works compared to SHA-256 itself. Double SHA-256 means you hash the value of an input using SHA-256 and you use the result from that as input for another round of SHA-256. So it's basically SHA-256(SHA-256(Message)). It's also stated in the protocol documentation: https://en.bitcoin.it/wiki/Protocol_documentation#Hashes
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
|
odolvlobo
Legendary
Offline
Activity: 4466
Merit: 3391
|
|
August 03, 2018, 10:09:43 PM |
|
Hi all,
Can someone explain me SHA 256 step by step mathematical operation taking an example,i want to know each step from conversion of word to ASCII code and binary code ,later right shift and all those stuffs till i get a hash.
And i have another question why bitcoin uses double SHA256,and how does double SHA 256 compared to normal SHA256 exactly work?
I want to be a blockchain developer so i need to learn all these from scratch.
Thank you
I think this is what you are looking for: Mining Bitcoin with Pencil and PaperThis video is fun to watch too: https://www.youtube.com/watch?v=y3dqhixzGVoThe double hash is simply a hash of a hash of the data. It provides extra security in certain cases. You don't need to know the details of the SHA-256 algorithm in order to use it. In fact, it is probably better that you not know it because if you know it, you might be tempted to implement it and make a mistake.
|
Join an anti-signature campaign: Click ignore on the members of signature campaigns. PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 04, 2018, 05:40:54 AM |
|
Hi all,
Can someone explain me SHA 256 step by step mathematical operation taking an example,i want to know each step from conversion of word to ASCII code and binary code ,later right shift and all those stuffs till i get a hash.
And i have another question why bitcoin uses double SHA256,and how does double SHA 256 compared to normal SHA256 exactly work?
I want to be a blockchain developer so i need to learn all these from scratch.
Thank you
I think this is what you are looking for: Mining Bitcoin with Pencil and PaperThis video is fun to watch too: https://www.youtube.com/watch?v=y3dqhixzGVoThe double hash is simply a hash of a hash of the data. It provides extra security in certain cases. You don't need to know the details of the SHA-256 algorithm in order to use it. In fact, it is probably better that you not know it because if you know it, you might be tempted to implement it and make a mistake. Thanks for providing the information,it was really fun but my brain got over clocked in the middle haha btw Mining Bitcoin with pencil and paper is it still profitable in 2018 ? Haha
|
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 04, 2018, 05:42:19 AM |
|
If you are looking for detailed information on the SHA-256 algorithm I suggest you read the document on Secure Hash Standard (SHS) here: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf That's a 36 page PDF so a bit too long to reproduce here. Regarding your question on double SHA-256 and how it works compared to SHA-256 itself. Double SHA-256 means you hash the value of an input using SHA-256 and you use the result from that as input for another round of SHA-256. So it's basically SHA-256(SHA-256(Message)). It's also stated in the protocol documentation: https://en.bitcoin.it/wiki/Protocol_documentation#HashesHey thank you for providing pdf link, looks like i have to study more about it.
|
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 04, 2018, 05:45:29 AM |
|
So is it impossible to hack double SHA 256 ? because Sha 1 was tamper proof too until someone proved they were wrong.How many years can we expect double SHA256 will be reliable ?.And thanks for providing the link of thread let me have a look at it.
|
|
|
|
amaclin1
|
|
August 04, 2018, 05:54:39 AM |
|
So is it impossible to hack double SHA 256 ? Nobody knows. At least most of people in the world do not know a way to do it. And we do not know any person who knows the hacking algorithm.
|
|
|
|
TheArchaeologist
|
|
August 04, 2018, 06:56:18 AM |
|
You don't need to know the details of the SHA-256 algorithm in order to use it. In fact, it is probably better that you not know it because if you know it, you might be tempted to implement it and make a mistake.
I couldn't agree more! I can understand you want to read up on hashing algorithms but you should never try to come up with your one solution. Instead, use a proven implementation (for example from a library) and treat it like a blackbox: you put something in and you will always get a 256 bit return.
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
butka
|
|
August 04, 2018, 07:01:43 AM |
|
So is it impossible to hack double SHA 256 ? because Sha 1 was tamper proof too until someone proved they were wrong.How many years can we expect double SHA256 will be reliable ?.And thanks for providing the link of thread let me have a look at it. It has nothing to do with hacking SHA-256 ( probably by hacking in your post you mean brute force attack ). The kind of attack that this double hash prevents is called length extension attack and it is something different from brute force attack. You can read more about the way this attack is done, for example, here.
|
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 04, 2018, 04:41:21 PM |
|
You don't need to know the details of the SHA-256 algorithm in order to use it. In fact, it is probably better that you not know it because if you know it, you might be tempted to implement it and make a mistake.
I couldn't agree more! I can understand you want to read up on hashing algorithms but you should never try to come up with your one solution. Instead, use a proven implementation (for example from a library) and treat it like a blackbox: you put something in and you will always get a 256 bit return. Ok i got that,so you mean don't worry about XOR gates or anything which is used ,consider it as some function which gives you a output,am i right?
|
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 05, 2018, 06:36:55 AM |
|
So is it impossible to hack double SHA 256 ? because Sha 1 was tamper proof too until someone proved they were wrong.How many years can we expect double SHA256 will be reliable ?.And thanks for providing the link of thread let me have a look at it. It has nothing to do with hacking SHA-256 ( probably by hacking in your post you mean brute force attack ). The kind of attack that this double hash prevents is called length extension attack and it is something different from brute force attack. You can read more about the way this attack is done, for example, here. i got to read it then as i knew only about brute force attack.
|
|
|
|
TheArchaeologist
|
|
August 06, 2018, 07:17:41 AM |
|
Ok i got that,so you mean don't worry about XOR gates or anything which is used ,consider it as some function which gives you a output,am i right?
Exactly, you don't need to know exactly how it works under the hood to use it!
|
Sooner or later you're going to realize, just as I did, that there's a difference between knowing the path and walking the path
|
|
|
bittab
|
|
August 08, 2018, 01:22:04 PM |
|
It is easy for Mac users to generate SHA-256 checksum.
Via Terminal, "shasum -a 256 anyfilename.abc"
|
|
|
|
Srujan007 (OP)
Jr. Member
Offline
Activity: 99
Merit: 1
|
|
August 12, 2018, 09:31:10 AM |
|
Thank you so much it worked.
|
|
|
|
|