Author

Topic: Why sha256(sha256()) ? (Read 1079 times)

newbie
Activity: 26
Merit: 0
November 22, 2015, 11:30:50 AM
#8
You also double SHA 256 when you build up the merkle tree.
staff
Activity: 3458
Merit: 6793
Just writing some code
November 22, 2015, 11:25:05 AM
#7
1. priv/pub key
2. SHA-256
3. RIPEMD-160
4. Add version byte 0
5. SHA-256
6. SHA-256
7. Take 4 bytes
8. Add 4 bytes to result of 4
9. Convert to base 58

The double SHA-256 is only for the 4 check bytes. Why is this important for security reasons?
It is used for mining. The mining algorithm is sha256d
newbie
Activity: 26
Merit: 0
November 22, 2015, 11:15:56 AM
#6
1. priv/pub key
2. SHA-256
3. RIPEMD-160
4. Add version byte 0
5. SHA-256
6. SHA-256
7. Take 4 bytes
8. Add 4 bytes to result of 4
9. Convert to base 58

The double SHA-256 is only for the 4 check bytes. Why is this important for security reasons?
member
Activity: 138
Merit: 25
November 22, 2015, 02:27:52 AM
#5
Twice Sha256 is to prevent length-extension attacks. If in theory, instead SHA-2 would be SHA-3, not need twice SHA?
legendary
Activity: 1134
Merit: 1118
November 21, 2015, 04:12:57 PM
#4
In Bitcoin Developer Reference https://bitcoin.org/en/developer-reference is in many places sha256(sha256()) instead sha256(), it has any meaning?

Yes sha256 is a hashing function used in the protocol. A hashing function is 'easy' to compute one way but difficult to compute the other way. Other hashing functions are SHA1 and MD5. MD5 is partly broken, lots of collisions.

I don't think you actually read the OP properly. Unsure if that's due to your signature or just due to inattentiveness. His question does not ask why hashing is used, I'm fairly sure he knows why it is used and he did refer to "instead of sha256()". He's referring to double hashing.
legendary
Activity: 4228
Merit: 1313
November 21, 2015, 04:06:56 PM
#3
I think he was asking why double hashing vs just a single sha256.

If so, it was to help prevent length-extension attacks:

see e.g.
http://crypto.stackexchange.com/a/884
hero member
Activity: 672
Merit: 508
LOTEO
November 21, 2015, 03:27:25 PM
#2
In Bitcoin Developer Reference https://bitcoin.org/en/developer-reference is in many places sha256(sha256()) instead sha256(), it has any meaning?

Yes sha256 is a hashing function used in the protocol. A hashing function is 'easy' to compute one way but difficult to compute the other way. Other hashing functions are SHA1 and MD5. MD5 is partly broken, lots of collisions.

From satoshi:
Quote
SHA-256 is very strong.  It's not like the incremental step from MD5 to SHA1.  It can last several decades unless there's some massive breakthrough attack.

If SHA-256 became completely broken, I think we could come to some agreement about what the honest block chain was before the trouble started, lock that in and continue from there with a new hash function.

If the hash breakdown came gradually, we could transition to a new hash in an orderly way.  The software would be programmed to start using a new hash after a certain block number.  Everyone would have to upgrade by that time.  The software could save the new hash of all the old blocks to make sure a different block with the same old hash can't be used.

member
Activity: 138
Merit: 25
November 21, 2015, 03:13:57 PM
#1
In Bitcoin Developer Reference https://bitcoin.org/en/developer-reference is in many places sha256(sha256()) instead sha256(), it has any meaning?
Jump to: