Is it possible to calculate sha256 hashes in the browser using the user's video card, eg. by using WebGL or Flash?
I'm afraid this is all there is to ask, but if more elaboration is needed please do not hesitate to tell me in a comment.
Thanks.
This should be possible. Given an implementation of SHA as a fragment shader, you should be able to read back the results using readPixels:
Read Back Pixels [5.13.12] Pixels in the current framebuffer can be read back into an ArrayBufferView object.
void readPixels(int x, int y, long width, long height, enum format, enum type, Object pixels)
format: RGBA
type: UNSIGNED_BYTE
From the Kronos WebGL reference card (PDF)
For extra credit, do it all in an offscreen framebuffer, as described here.
Looks like this can be done (although in this case it's not SHA256). The following is an example of a JavaScript library that uses WebGL2 to calculate hash values on the client side, for the Curl hashing algoritm: https://github.com/iotaledger/curl.lib.js/
In this case it's used to do Proof of Work for an IOTA transaction (https://www.iota.org/get-started/what-is-iota). This basically comes down to brute-forcing random inputs into the same hash function until the result matches a certain output. Therefore the gained hashing speed by using WebGL is very relevant. I have used it, and it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With