SyneRBI / SIRF-Exercises

SIRF Training and demonstration material
http://www.ccpsynerbi.ac.uk
Apache License 2.0
18 stars 21 forks source link

MacOS doesn't have md5sum #105

Closed KrisThielemans closed 3 years ago

KrisThielemans commented 3 years ago

Noticed by @DANAJK .

searching online finds lots of links that md5 outputs the hash, but nothing that checks the md5. sigh

KrisThielemans commented 3 years ago

@DANAJK could you check if the following gives similar output to the stored md5

md5 -r PTB_ACRPhantom_GRAPPA.zip

If so, the following would be a replacement I believe, so could you check that as well?

md5 -r PTB_ACRPhantom_GRAPPA.zip | diff -q PTB_ACRPhantom_GRAPPA.zip.md5
# check in terminal
echo $?

the latter should print 0. If it does, we want to check with a wrong file as well

md5 -r PTB_ACRPhantom_GRAPPA.zip.md5 | diff -q PTB_ACRPhantom_GRAPPA.zip.md5
# check in terminal
echo $?

should print 1

DANAJK commented 3 years ago

In a Mac terminal, md5 -r PTB_ACRPhantom_GRAPPA.zip gives a7e0b72a964b1e84d37f9609acd77ef2 PTB_ACRPhantom_GRAPPA.zip which seems to correspond correctly to the file PTB_ACRPhantom_GRAPPA.zip.md5

However, I don't seem to be able to correctly pipe to diff (maybe the output from md5 is not a file?):

(base) davidatkinson@Davids-MacBook-Pro devel % md5 -r PTB_ACRPhantom_GRAPPA.zip | diff -q PTB_ACRPhantom_GRAPPA.zip.md5
diff: missing operand after `PTB_ACRPhantom_GRAPPA.zip.md5'
diff: Try `diff --help' for more information.
KrisThielemans commented 3 years ago

ok, what about

md5 -r PTB_ACRPhantom_GRAPPA.zip > test.md5
diff -q test.md5 PTB_ACRPhantom_GRAPPA.zip.md5
DANAJK commented 3 years ago

Yes, that works, along with the echo $?