Hacker News new | ask | show | jobs
by xurukefi 2306 days ago
Didn'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.
1 comments

True, the benchmarks are bad. I'll rewrite them (to drop the cache every time) and update the results.