3 ms·
Just to remind people of `look`, which does a binary search. It might be superior to the articles methods if you only want to search for a few.
by emmelaich 7y ago
Just to remind people of `look`, which does a binary search.
It might be superior to the articles methods if you only want to search for a few.
- lolc 7y agoFunny how many tools are stowed on my system. I'll never know them all!
- xurukefi 7y agoDidn't know about look. Seems good enough (tested on a HDD): $ dd of=pwned-passwords-sha1-ordered-by-hash-v5.txt oflag=nocache conv=notrunc,fdatasync count=0 0+0 records in 0+0 records out 0 bytes (0 B) copied, 9.5864e-05 s, 0.0 kB/s $ time look `sha1sum <(echo -n password) | tr [a-z] [A-Z] | cut -d" " -f1` pwned-passwords-sha1-ordered-by-hash-v5.txt 5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8:3730471 real 0m0.137s user 0m0.002s sys 0m0.013s dd is used to drop the file from the fs cache. Something the author probably didn't do given the unrealistic 49μs. It's simply not possible to fetch data from a HDD that fast.
- stryku2393 7y agoTrue, the benchmarks are bad. I'll rewrite them (to drop the cache every time) and update the results.
- iseeyou 7y agowow, thanks, yet another tool to remember in the toolbox sudo purge time look E38AD214943DAAD1D64C102FAEC29DE4AFE9DA3D pwned-passwords-sha1-ordered-by-hash-v5.txt E38AD214943DAAD1D64C102FAEC29DE4AFE9DA3D:2413945 0.01 real 0.00 user 0.00 sys` not 49us, but fast enough for most use cases (purge should clear the fs cache)