Show HN: I made a C program to create a vanity SHA-1 hash for a text file
57 points
5 days ago
| 5 comments
| gist.github.com
| HN
keepamovin
5 days ago
[-]
After experimenting with cycling punctuation, and random capitalization I hit on the idea to use each word as a bit and map the original version of the word to 0 and the title-case-toggled version of the word to 1.

Then just use the text file as a "counter nonce" and count from 0 until we find a counter that hashes to the vanity prefix we want.

The advantage of this is flipping the capitalization of the first letter of each word doesn't drastically alter the visual appearance of the file (tho it may alter semantics!), and you get an easy to understand amount of entropy (number of states) to walk through.

The C version linked only supports counting up to ~4 billion but it could be easily extended. A JS version using BigInt can go unlimited.

For reference the included example text took a surprising 2 billion iterations to discover the correct 8 digit hash which is about what you'd expect from random (i.e., half the state space of 16*8 = (2*4)*8)

reply
kazinator
2 days ago
[-]
Don't bother applying here if your github doesn't look like this:

  $ git log --oneline
  deadbeef5 (HEAD -> master): Revised documentation of frobozz widget.
  0cafef00d scrot_compress: fixed rare recursion case.
  5ca1ab1e1 image_convolve: use thread pool for better performance.
reply
jagged-chisel
2 days ago
[-]
Sadly, you won’t get any senior applicants if you’re mistaking the website for the tool.
reply
kazinator
2 days ago
[-]
Here, that touch is necessary for a hint of realism.
reply
actinium226
1 day ago
[-]
I don't get the last one?
reply
ruffrey
1 day ago
[-]
"scalable"
reply
TZubiri
1 day ago
[-]
This is cute but it works in the opposite for me, looks very unprofessional and gives the impression you get distracted with nerdy internals instead of building product.
reply
fyrn_
1 day ago
[-]
On the other hand, where I work we want people like that. Not every place is a CRUD slop shop with joined at the hip SPA that needs more meat for the ginder. Research and specialized optimization roles exist
reply
coolThingsFirst
2 days ago
[-]
what?
reply
frutiger
2 days ago
[-]
Read the commit sha prefixes as English
reply
celegans25
2 days ago
[-]
Look at the hashes of the commits
reply
coolThingsFirst
2 days ago
[-]
Interesting, also this quote is as interesting as the code:

"Your job, throughout your entire life, is to disappoint as many people as it takes to avoid disappointing yourself."

reply
metadat
1 day ago
[-]
That took a second to process and sink in.

Added to my shameful, neurotic HN profile.. haha, thank you!

reply
susam
2 days ago
[-]
The SHA-256 hash of this sentence begins with 0573e7473.
reply
orphea
2 days ago
[-]
The SHA256 for this sentence begins with: one, eight, two, a, seven, c and nine.
reply
tmountain
2 days ago
[-]
Oh boy, here we go…
reply
keepamovin
1 day ago
[-]
That's a fun way to do it! :)
reply
keepamovin
1 day ago
[-]
OK, that's a cool way to fuzz the digest rather than the text :)
reply
akoboldfrying
1 day ago
[-]
The SHA-256 hash of this sentence does not.
reply
xeckr
2 days ago
[-]
Nice one.
reply
saulpw
1 day ago
[-]
Cool! I made a multithreaded version about 10 years that works for binary files like .zip files: https://github.com/century-arcade/src/tree/master/tools/vain...
reply
keepamovin
1 day ago
[-]
Cool! How do you handle internal checks in the files? How does overwriting 8 zeroes not break stuff?
reply
saulpw
1 day ago
[-]
Well it was intended/used to fill out a .zip file comment section, so those 8 zeroes were ignored anyway.
reply
keepamovin
17 hours ago
[-]
Smart!
reply