Hacker News new | past | comments | ask | show | jobs | submit login

Title checks out.

    > md5sum md5.gif 
    f5ca4f935d44b85c431a8bf788c0eaca  md5.gif



Never knew that md5sum took a file argument. I've always `md5sum <foo`

Slightly embarrassing, but at least I wasn't `cat foo|md5sum`


The output format of md5sum and other checksum programs is well-defined, which lets you use the -c switch to verify. This is the format you see in checksum files when downloading source tarballs, distro ISOs, packages, etc.

    $ echo hello > fileone
    $ echo there > filetwo
    $ md5sum fileone filetwo | tee /tmp/ck
    b1946ac92492d2347c6235b4d2611184  fileone
    c4ff45bb1fab99f9164b7fec14b2292a  filetwo
    $ md5sum -c /tmp/ck
    fileone: OK
    filetwo: OK
    $ echo oops > filetwo
    $ md5sum -c /tmp/ck
    fileone: OK
    filetwo: FAILED
    md5sum: WARNING: 1 computed checksum did NOT match
Edit: Of course, nothing wrong with using stdin:

    $ wget -q -O- https://shells.aachen.ccc.de/~spq/md5.gif | md5sum 
    f5ca4f935d44b85c431a8bf788c0eaca  -


What's the -O- for?


Output to stdout instead of a file on disk.

See: https://linux.die.net/man/1/wget


-O is the file to write output. plain - means stdout. so, run wget and print results to stdout. tip: add -S to include response http headers.


It's nice to hash a couple files and have the hashes displayed right next to each other :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: