News for hackers. Stuff that matters.
Re:Show HN: SHAllenge – Compete to get the lowest Hash by NAHWheatCracker on Saturday June 15, 2024 @06:13PM (#40693091)
I added some instrumentation and it was doing around 3.3 million hashes per second. Mine isn't sequential, it's generating random strings. Changing from a 64 byte string to a 26 byte string with (14 character nonce) brought it up to around 6 MH/s.

Given the nonces you provided, I guess you're going sequential and you're hashing 2-3 times faster than me. I just got a 7 0 hash in 70 seconds and an 8 0 hash in 164 seconds. You're right and I was overestimating how long I waited around last night.

Re:Show HN: SHAllenge – Compete to get the lowest Hash by SushiHippie on Saturday June 15, 2024 @06:48PM (#40693275)
After experimenting more with this, it seems like with random generation the bottle neck is the "input generation" and not the hashing itself, that's why I went with sequential.

I replaced my nonce generation with a static string and my hashrate went to the moon, so I invested more time in optimizing my input generation.

Re:Show HN: SHAllenge – Compete to get the lowest Hash by NAHWheatCracker on Saturday June 15, 2024 @09:50PM (#40694098)
I profiled my code and you're right that it was using a big chunk of CPU on generating the input. Approximately 40-50% of the CPU time was taken up by go's rand.IntN function.

I was able to optimize it so that I only call rand.Int63 twice per string generation, bringing the CPU time of that part down to 10-15%. I'm getting 11.3 MH/s now!

Re:Show HN: SHAllenge – Compete to get the lowest Hash by amenhotep on Saturday June 15, 2024 @10:37PM (#40694292)
There is really no point randomising at all, any cycles you spend on it are a total waste - one of the most important properties of a good hash algorithm is that a one bit change in the input should result in an output that's completely unrelated to the previous.

Your random number generator is pretty much equivalent to feeding a counter into SHA256, so using it as input is pretty much equivalent to hashing a counter twice. There's no point!

Re:Show HN: SHAllenge – Compete to get the lowest Hash by NAHWheatCracker on Saturday June 15, 2024 @11:00PM (#40694363)
Yea, I know. It makes me feel better this way, though.
Re:Show HN: SHAllenge – Compete to get the lowest Hash by NAHWheatCracker on Saturday June 15, 2024 @11:49PM (#40694554)
BTW, I changed it so it's iterative, getting 12.5 MH/s.