coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New option for md5sum


From: Bob Proulx
Subject: Re: New option for md5sum
Date: Fri, 18 Apr 2014 20:48:49 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Pádraig Brady wrote:
> djcj wrote:
> > Can you add an option to md5sum that allows one to output only the checksum?
> > Here's a code example:
> 
> Thanks for the patch.
> However this is one of those marginal cases where it's
> probably not worth the extra option to do this simple adjustment.

After all of this time I think it is one of standard is better than
better and all of the implementations are already the other way.

> At the shell you can do: md5sum < the_file | cut -b1-32

Rather than cut and using an exact number of characters I prefer to
use awk to cut by fields.  That way it works with all of the *sum
programs.

  $ md5sum /dev/null | awk '{print$1}'
  d41d8cd98f00b204e9800998ecf8427e

  $ sha1sum /dev/null | awk '{print$1}'
  da39a3ee5e6b4b0d3255bfef95601890afd80709

  $ sha512sum /dev/null | awk '{print$1}'
  
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e

> Also if running from another program, one could easily
> take the start of the output (accounting for leading backslashes).
> 
> So I'd be 70:30 against adding this.

I would only add it if there were the creation of a new sum program.
Then it could be counted upon to exist in that program throughout the
lifetime of it.  But needing to add the option "--short" is already
almost as long as "awk '{print$1}'" so doesn't seem to be compelling.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]