You are not logged in.
This is a script I use almost on daily basis. I use it for everything I download which has a checksum on the side to verify it with. I first made it in OS X, but it's been updated a while ago to work on Linux/*BSD as well (eg with the GNU-Utils). It's nothig fancy or so, just a simple “helper”. (I'm sure the script could be written more optimized, but hey … it works.) ![]()
Link: chksum
Example:
$ chksum md5 d41d8cd98f00b204e9800998ecf8427e foo.bar
foo.bar: ... OK
$ chksum md5 d41d8cd98f00b204e9800998ecf8427f foo.bar
foo.bar: ... FAILED
chksum: WARNING: The checksum (d41d8cd98f00b204e9800998ecf8427f) did NOT match- - -
2 xtras (somewhat related)
Coming from OS X, I (sometimes) miss `md5` and `shasum`. So, in case anyone else needs them for the transition or to use as a layer to make (osx) scripts compatible. Here are 2 (very) simple wrappers. There are no advance checking or anything, just 2-3 options from each “translated”.
I once found a MD5 I compiled, but it wasn't the same thing.
What I miss in `md5sum` is -s and -q options.
Examples:
# -s = string (text)
$ md5 -s "I'm a text string"
MD5 ("I'm a text string") = 9fb4b4561f538606cd87bf69a7c67c6e
# -q = silent. Only the checksum. Great for scripting.
$ md5 -q fooBar.txt
d41d8cd98f00b204e9800998ecf8427eshasum
File: shasum
ReadMe: shasum.md
`shasum` Includes all shaNNNsum...
Examples:
# default = sha1
$ shasum fooBar.txt
da39a3ee5e6b4b0d3255bfef95601890afd80709 fooBar.txt
# -a = algoritm
shasum -a 256 fooBar.txt
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 fooBar.txtPerhaps not the most useful ones, but they've helped me in my transition. And sometimes the “muscle memory” kicks in (since I stlll use OS X on the side) and I type them accidently. And not that I not use the GNU-utils programs, they servre more as complliments/addons (to me).
- - -
Hope you find them useful.
/Eric
Last edited by genEric (2015-08-08 08:36:52)
[genEric@…] ~$
Offline
I don't know why you miss these tools, they certainly exist in linux:
$ pkgfile md5sum
core/coreutils
$ echo -n "I'm a text string" | md5sum
9fb4b4561f538606cd87bf69a7c67c6e -
$ ls /usr/bin/sha*
/usr/bin/sha1pass /usr/bin/sha1sum /usr/bin/sha224sum /usr/bin/sha256sum /usr/bin/sha384sum /usr/bin/sha512sum"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I don't know why you miss these tools, they certainly exist in linux:
// ... //
Ah, sorry. It wasn't what I (really) meant. I guess it's more the programs/syntax itself. Of course I can perform simular things with the GNU-utils software. The wrappers are more a way to be able to use them in another way. And of course, as compat layers if/when I need them. But those were just xtras. It was `chksum` I wanted to share.
[genEric@…] ~$
Offline
chksum
Example:
$ chksum md5 d41d8cd98f00b204e9800998ecf8427e foo.bar foo.bar: ... OK $ chksum md5 d41d8cd98f00b204e9800998ecf8427f foo.bar foo.bar: ... FAILED chksum: WARNING: The checksum (d41d8cd98f00b204e9800998ecf8427f) did NOT match
Sorry but what is the difference with just doing this:
$ echo "d41d8cd98f00b204e9800998ecf8427e foo.bar" | md5sum -c
foo.bar: OK
$ echo "d41d8cd98f00b204e9800998ecf8427f foo.bar" | md5sum -c
foo.bar: FAILED
md5sum: WARNING: 1 computed checksum did NOT matchCedric Girard
Offline