Skip to main content
18 votes

Why are hashes in the bitcoin protocol typically computed twice (double computed)?

The wiki claim that this is to prevent birthday attacks is wrong. If you can successfully execute a birthday attack on a single call to the hash function, you get a successful birthday attack on the ...
mikeazo's user avatar
  • 281
14 votes

Why are hashes in the bitcoin protocol typically computed twice (double computed)?

Like others have said, the wiki claim of this preventing birthday attacks is wrong. Rather, this was meant to prevent against length extension attacks. From https://crypto.stackexchange.com/a/884/...
Zain Rizvi's user avatar
14 votes
Accepted

What is the reasoning behind the choice of 2^256-2^32-977 for the prime on the secp256k1 curve?

Secp256k1 was designed to be a 256-bit size elliptic curve without cofactor and admitting an efficient endomorphism for optimization purposes. The choices of the relevant parameters are derived from ...
G. Maxwell's user avatar
  • 7,727
13 votes
Accepted

checksum = SHA256(SHA256(prefix+data)) - why double hashing?

Satoshi standardized on using double-SHA256 for 32-byte hashes, and SHA256+RIPEMD160 (each once) for 20-byte hashes, presumably because of (likely misguided) concern about certain attacks (like length ...
Pieter Wuille's user avatar
11 votes

Why does the TXID have 256 bits when Bitcoin's address security is 160-bit?

Security levels First of all, the relation between security level and the number of bits involved is non-trivial, and depends on the sort of attack we're talking about. For what follows, there are ...
Pieter Wuille's user avatar
10 votes
Accepted

Is the SHA256 value in the bitcoin address wiki accurate?

The problem is that you're treating the pubkey as string data. What you need to do is treat it as raw binary hexadecimal. If you use fileformat.info and calculate it using Binary Hash hex bytes you do ...
greatwolf's user avatar
  • 627
10 votes
Accepted

Which is the smallest hash that has ever been hashed?

The 12 lowest block hashes in Bitcoin as of Jan 22 2023: Block 756951 (0000000000000000000000005d6f06154c8685146aa7bc3dc9843876c9cefd0f) Block 742035 (...
Pieter Wuille's user avatar
9 votes
Accepted

How to generate a Bitcoin Private Key Checksum

F29E9187 are indeed the first four bytes of the double sha256 of the bytes: 802CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B982401 In order to check this, you need to compute the ...
Sven Williamson's user avatar
9 votes

If SHA256 produces an alphanumeric hash, how can a hash be "less than a certain value"?

Not that other answers are wrong here, but just to approach your confusion from another angle: SHA256 hashing algorithm, which produces alphanumeric hashes. That's not true. The hashing algorithm ...
Jannes's user avatar
  • 6,344
8 votes
Accepted

Is Bitcoin PoW actually SHA256 + Merkle generation? Or have I misunderstood coinbase/append?

You are correct that effectively Bitcoin PoW involves computing the Merkle root every now and then in addition to the hash grinding. However, this is negligable. Even ignoring nTime rolling, the ...
Pieter Wuille's user avatar
8 votes

Are miners advertised hash rate single or double hash speeds?

Modern miners on the market have up to 110 TH/s. Is this the true hash rate (singular SHA-256 hashes per second) or the net hashes relating to Bitcoin specifically (since Bitcoin involves double ...
Pieter Wuille's user avatar
7 votes
Accepted

What are the 3 arguments called in function SHA256?

Let's disect this function call: void sha256(struct sha256 *sha, const void *p, size_t size) First we realize that the return value is void which means the function does not return the sha256 of the ...
Rene Pickhardt's user avatar
7 votes
Accepted

How many bitcoin transactions can be verified per second on commodity hardware in 2020?

As others have pointed out, this largely depends on what kind of transaction you're verifying. More inputs and more signatures means longer verification, and for pre-SegWit inputs the computational ...
Vojtěch Strnad's user avatar
6 votes
Accepted

If SHA256 produces an alphanumeric hash, how can a hash be "less than a certain value"?

The hash is not alphanumeric, it's hexadecimal, that is base-16. You can convert that to a decimal number. In your case: 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 = ...
Jimmy Song's user avatar
  • 7,759
6 votes
Accepted

How long does it take to perform a single SHA256?

Simply head over to https://en.bitcoin.it/wiki/Non-specialized_hardware_comparison#CPUs.2FAPUs and look it up. For AMD, the columns nprocs and Mhash/s are important. Divide the latter by the former, ...
UTF-8's user avatar
  • 3,224
6 votes

Which is the smallest hash that has ever been hashed?

Just for fun I made a program to list all record low hashes starting from block 1 ... Max block count: 773048 Block 1 : 00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 Block ...
johanpm's user avatar
  • 106
6 votes
Accepted

What previously existing technologies made Bitcoin possible?

Arvind Narayanan and Jeremy Clark wrote an excellent paper about that: Bitcoin's Academic Pedigree. I recommend reading the paper in full, but the following briefly summarizes the paper's content. ...
Murch's user avatar
  • 75.9k
5 votes
Accepted

Is this how I should calculate a Double SHA256

Yes you should convert your first output before feeding it back in: A hash function is typically a function which takes in an array of bytes (of arbitrary size) and spits out an array of bytes (of ...
Sven Williamson's user avatar
5 votes
Accepted

How to compute double sha256 shown in examples of bip 143?

Do this: echo -n $PREV_OUT | xxd -r -p | openssl dgst -sha256 -binary | openssl dgst -sha256 Explanation You want to do this: prevout (raw bytes) -> sha256 -> sha256 -> convert to hex You're ...
Nick ODell's user avatar
  • 29.4k
5 votes

Which is the smallest hash that has ever been hashed?

I don't think there is a site that will show you this information, but it is fairly trivial to find out. Here's an old Bitcointalk thread that discusses this: https://bitcointalk.org/index.php?topic=...
Ava Chow's user avatar
  • 70.9k
5 votes

Which is the smallest hash that has ever been hashed?

As an alternative to syncing a full Bitcoin node, there is a BigQuery public dataset for Bitcoin (and some other cryptocurrencies): SELECT `number`, `hash` FROM `bigquery-public-data....
penfold's user avatar
  • 151
5 votes
Accepted

Do pools distribute "jobs" to miners based on "failed" solutions which have already been submitted?

I've read simplistic descriptions of mining as simply incrementing the nonce until a solution is found, but I've also read much more detailed explanations which would imply much more is involved. Even ...
Ava Chow's user avatar
  • 70.9k
5 votes
Accepted

Why is the tag repeated twice in a tagged hash?

"optimized implementations are possible": What specifically is the optimization being talked about here, is it caused by the prefix being the same size as the block size of SHA-256? If so, ...
Pieter Wuille's user avatar
5 votes
Accepted

How long would it take for all smartphones on the planet to fully reverse a SHA-256 hash?

An Apple M1 CPU can do around 2 GB/s of SHA256 (based on the optimized 2-way hardware-accelerated ARMv8 code in Bitcoin Core added in PR24115) on a single core. Smartphones are significantly slower ...
Pieter Wuille's user avatar
5 votes

SHA-256 hashing algorithm

The SHA-256 algorithm is not defined in the Bitcoin GitHub repository, it is defined in the USA Federal Information Processing Standards (FIPS) publication 180-2 (see Wikipedia: SHA-2). The ...
RedGrittyBrick's user avatar
4 votes

Using ASIC for password cracking - mad concept?

It will not help even if passwords were hashed with DSHA256. This link explains why. https://rya.nc/asic-cracking.html Basically the ASIC loads the header into its memory and increments the nonce ...
SentinalBais's user avatar
4 votes

If SHA256 produces an alphanumeric hash, how can a hash be "less than a certain value"?

You treat the hash as a base 16 number, and compare it like you would an integer. So, for example, with normal numbers, to determine that 926 is less than 941, you basically follow this reasoning: ...
morsecoder's user avatar
  • 14.2k
4 votes
Accepted

How can I check the hash of a bitcoin block?

Seems to me that you are hashing the whole block instead of header only. Take my code (in C++). void test ( ) { const MyByteArray header ( QByteArray::fromHex ( "00000020" // version "...
amaclin's user avatar
  • 6,780
4 votes
Accepted

Confused on using SHA256 code from Bitcoin Core

sha256.h has the exported (visible from outside) methods and functions. To compute SHA256, you should #include that. sha256_sse4.cpp sha256_sse41.cpp sha256_avx2.cpp sha256_shani.cpp contain SHA256 ...
MCCCS's user avatar
  • 10.2k
4 votes
Accepted

Can you crack SHA-256?

There is a large difference between being able to produce the preimage for a single SHA256 hash for which you may know certain factors like length, character set, etc., and being able to break SHA256 ...
Raghav Sood's user avatar
  • 17.1k

Only top scored, non community-wiki answers of a minimum length are eligible