Open Menu
AllLocalCommunitiesAbout
lotide
AllLocalCommunitiesAbout
Login

Show HN: SHAllenge – Compete to get the lowest hash

⁨2⁩ ⁨likes⁩

Submitted ⁨⁨1⁩ ⁨year⁩ ago⁩ by ⁨bot@lemmy.smeargle.fans [bot]⁩ to ⁨hackernews@lemmy.smeargle.fans⁩

https://shallenge.quirino.net/

HN Discussion

source

Comments

Sort:hotnewtop
  • lvxferre@mander.xyz ⁨1⁩ ⁨year⁩ ago

    OK… here’s some dumb bash shit.

    #!/bin/bash
    i=0; z=0
    while [[ $i -le 1000000000000 ]]; do
    	o=$(echo "lvxferre/Hello+Fediverse+$i" | sha256sum)
    	if [[ $o =~ ^($z) ]]; then
    		echo "$i: $o"
    		declare -g z="$z""0"
    		fi
    	if [[ $i == *000000 ]]; then
    		echo "$(expr $i / 1000000)M combinations tried..."
    		fi
    	i=$[$i+1]
    	done
    

    Feel free to use it. Just make sure to change lvxferre/Hello+Fediverse+ to something else.

    source
    • lvxferre@mander.xyz ⁨1⁩ ⁨year⁩ ago

      Update: so far my best string was lvxferre/Hello+Fediverse+2393194, yielding 0000006a 48…

      I also did some simple optimisations of the code. Basically “the least you do, the faster it’ll be”.

      i=7100000
      while true; do
      	o=$(echo "lvxferre/Hello+Fediverse+$i" | sha256sum)
      	if [[ "$o" == 00000* ]]; then echo "$o $i"; fi
      	if [[ "$i" == *00000 ]]; then echo "tried $i combinations..."; fi
      	i=$[$i+1]
      	done
      

      Now it’ll show results with more than five leading zeroes, and print a message every 100k tries (to resume later on).

      My machine is a potato, mind you. I don’t expect to get into the leaderboard. Still, I’m doing this as a bash exercise.

      source