This is my solution in CUDA for this challenge: https://shallenge.quirino.net/
Get the lowest possible SHA256 hash with a string in the format "{username}/{nonce}"
- username: 1-32 characters from a-zA-Z0-9_-
- nonce: 1-64 characters from Base64 (a-zA-Z0-9+/)
This repository contains 2 CUDA files.
- shallenge.cu: This file contains my solution with some hard coded values and pre-calculated values.
- shallengeBase.cu: This file contains my solution without hard coded values and pre-calculated values. You can simply define any string you want (in
USERNAME_NONCE
) as long as its not more than 43 characters long and it should start hashing rapidly trying to find a hash with at least 11 zeros. This file is meant to be used as a starting point if you want to start hard coding some values to make it run faster.
- CUDA Toolkit (Tested on 10.2 and 12.6)
If you have make
installed in your system you can simply compile providing the Compute Capability of your GPU, in my case 3.0
make CC=30
nvcc -arch=compute_XX -code=sm_XX --use_fast_math -O3 -o shallenge.exe shallenge.cu
Replace XX with the Compute Capability (CC) of your Nvidia card.
nvcc -arch=compute_30 -code=sm_30 --use_fast_math -O3 -o shallenge.exe shallenge.cu
In CUDA Toolkit 11 new flag was added to nvcc, --extra-device-vectorization
which "enables more aggressive vectorization of device code" and should be used to compile this program.
With shallenge.cu
I managed to get:
- 18.8 GHs - RTX 4090 (16 THREADS_PER_BLOCK, 64 BLOCKS)
- 211 MHs - GTX 650 Ti BOOST (16 THREADS_PER_BLOCK, 32 BLOCKS)
With shallengeBase.cu
I got:
- 150 MHs - GTX 650 Ti BOOST (16 THREADS_PER_BLOCK, 32 BLOCKS)