Bitcoin Forum
May 04, 2024, 10:57:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Maybe there is a possibility to discard unfitting hashes early?  (Read 841 times)
W-M (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 100

In Crypto we Trust.


View Profile
November 25, 2013, 11:20:13 AM
 #1

I do not understand cryptographic hashes,especially SHA-256 enough to be an expert on the subject. This is why I would like the opinion(telling me I'm wrong or right) of someone who does fully understand the SHA-256 algorithm and how it is implemented in the Bitcoin Protocol.


The difficulty in Bitcoin Mining is determined by the amount of zero's at the start of a hash. Of course, most elements of the hash influence eachother, but wouldn't it mean a huge increase in mining speed if we could figure out when a hash will turn out not to fit the difficulty?

As far as I know, the SHA-256 algorithm is built from right-to-left(Little Endian to Big Endian): The higher characters are dependent on the lower ones (By using: Higher = Higher + Lower % 2^32) but it does not seem to be the other way around.

This means that whenever we find out that at a certain spot above the difficulty treshold there wont be a zero in the final hash, we can discard this hash and instead move on to the next hash.


Does this make sense? Or did I miss something crucial?

~W-M

SatoshiCarnival.co ♢ Refreshing ♥ Fair ♧ Bitcoin Casino

WMCode ~ Web Development ~ Design
1714863462
Hero Member
*
Offline Offline

Posts: 1714863462

View Profile Personal Message (Offline)

Ignore
1714863462
Reply with quote  #2

1714863462
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.
1714863462
Hero Member
*
Offline Offline

Posts: 1714863462

View Profile Personal Message (Offline)

Ignore
1714863462
Reply with quote  #2

1714863462
Report to moderator
1714863462
Hero Member
*
Offline Offline

Posts: 1714863462

View Profile Personal Message (Offline)

Ignore
1714863462
Reply with quote  #2

1714863462
Report to moderator
1714863462
Hero Member
*
Offline Offline

Posts: 1714863462

View Profile Personal Message (Offline)

Ignore
1714863462
Reply with quote  #2

1714863462
Report to moderator
stillfire
Full Member
***
Offline Offline

Activity: 124
Merit: 100


View Profile
November 25, 2013, 12:56:32 PM
 #2

As far as I know, the SHA-256 algorithm is built from right-to-left(Little Endian to Big Endian): The higher characters are dependent on the lower ones (By using: Higher = Higher + Lower % 2^32) but it does not seem to be the other way around.

The SHA-256 is not built from right to left. An important part of a hashing algorithm is "mixing", where input "lines" are crossed left and right so they end up connecting to other output "lines". So if (simplified) bit 0 of the input is a 1 this might cause bit 129 of the output to be 0.

If this was all there was to it, it would be easy to build an algorithm that quickly ruled out unsuitable inputs. But in addition to this, the actual "direction" the bits "move" through the system is controlled by the other bits of the input. So (again simplified) we might see that if input bit 0 is a 1, and input bit 7 is a 1, bit 129 might be 0. But if input bit 7 is a 0, instead bit 201 becomes a 0 and bit 129 is unaffected.

This process is repeated on its own output over and over, until finally you have a situation where there are as many "maps" describing how each 1 input bit affects 1 output bit as there are combinations of other bits in the input. The number of possible maps is Very Large.

As you get closer and closer to the final iteration of the hash, the number internal bit states for which the final output can start with a 0 is rapidly falling off. However the "mathematical equation" for whether we'll have a leading 0 or not, which we could use to test whether we should abort the hash attempt early, is too complex and too slow to evaluate to be worth it. It's faster to just finish the hashing attempt.

Lost your wallet password? Try Stillfire's Password Recovery Service.
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
November 25, 2013, 01:13:39 PM
 #3

There are a few operations at the end that can be omitted as far as I understand, mining software does this already for years now though.

The problem is it takes very long until you really know or can at least reasonably guess that indeed there will be no 0 or a lot of 0s at a certain part of the hash.

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
W-M (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 100

In Crypto we Trust.


View Profile
November 25, 2013, 03:30:34 PM
 #4

Thank you very much for your replies. I guess that makes sense. I must have misread about the SHA256 algorithm somewhere, as I did not know that much mixing was involved.

Thank you!

SatoshiCarnival.co ♢ Refreshing ♥ Fair ♧ Bitcoin Casino

WMCode ~ Web Development ~ Design
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!