Jump to content
  • Advertisement
Sign in to follow this  
Vortez

Hash on gpu?

This topic is 1156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i just wanted to know if it's possible to compute a hash on the gpu, like crc32 or something stronger(sha-1?)

, in an efficient manner? If so, how, how would i retreive the result?

Share this post


Link to post
Share on other sites
Advertisement

Take a look at some of the bitcoin mining software out there, you might find some that can still hash on GPU. There should be some on github and the like

Share this post


Link to post
Share on other sites


Hi, i just wanted to know if it's possible to compute a hash on the gpu ... in an efficient manner?
Nope. Hashes are mostly sequential in nature. Fetching the result of stage N as input to stage N+1 is common. In some cases, steps might have side-effects which might force you to run them fully sequentially.

This implies hashing generic data blobs cannot saturate the GPU ALUs.

 

What you can do however is to use a merkle tree - an array of hashes of partitions - and them somehow combine them.  Here are some pictures.

 


If so, how, how would i retreive the result?
You just read a buffer as usual.

Note however for game related purposes (of identifying resources or similar) there's likely not much of a point in transferring the data over PCIex. For some small data the latency involved can probably negate the benefits. On iGPU we might talk but in general I would second NightCreature' suggestion.

 


Take a look at some of the bitcoin mining software out there, you might find some that can still hash on GPU. There should be some on github and the like

FYI, GPU mining is still very much around albeit not in BTC specifically. They're not generic hashers anyway as they hash 80-byte blocks which change value according to a set of rules. Furthermore, it is very common to confuse the property of the hash itself with the properties of the (parallel) scanHash operation. In short, I wouldn't suggest to take a look at them, the host code is particularly ugly.

 

Note: I am the author and maintainer of one of such apps. Of course mine is... fairly different.

Share this post


Link to post
Share on other sites

The question I am asking myself is why do you want to do this on the GPU. If its just to have a resource name changed in a hash the CPU will do fine for that.

 

Hashes aren't used exclusively for mapping resource names to numeric identifiers...

Share this post


Link to post
Share on other sites

 

The question I am asking myself is why do you want to do this on the GPU. If its just to have a resource name changed in a hash the CPU will do fine for that.

 

Hashes aren't used exclusively for mapping resource names to numeric identifiers...

 

In the context of gaming however that is the most common use, I know that hashes are used for other things too.

Share this post


Link to post
Share on other sites

Maybe I'm mistaken, but isn't it actually the case that GPUs aren't particularly good for calculating the hash, they are serial after all? GPUs are great for crypto-currency mining and password cracking because those things involve computing (possibly) the entire set of all hashes and looking for one among them that satisfies given properties (e.g. in bitcoin, a hash which has the correct number of leading zero bits for the current difficulty). You might want to calculate a hash of data already on the GPU, in which case its probably faster to do it there, but its probably not a win to shuffle data to the GPU just to take any old hash (but probably if you want to generate one with special properties).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!