bug-coreutils
[Top][All Lists]
Advanced

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

Re: [FEATURE_REQUEST] support openssl checksum format too


From: Jim Meyering
Subject: Re: [FEATURE_REQUEST] support openssl checksum format too
Date: Sat, 26 Sep 2009 07:59:24 +0200

Guenter Knauf wrote:
> suprisingly I just found that md5sum and sha1sum also accept the formats
> of the md5 and sha1 tools as input with option -c. There's though a
> third checksum format which is produced by the openssl tool which only
> slightly differs to the format from md5 and sha1 - two blanks are
> missing ...
> output of 'md5 file':
> MD5 (httpd-2.2.14.tar.bz2) = a5226203aaf97e5b941c41a71c112704
> output of 'openssl md5 file':
> MD5(httpd-2.2.14.tar.bz2)= a5226203aaf97e5b941c41a71c112704
> output of 'sha1 file':
> SHA1 (httpd-2.2.14.tar.bz2) = eacd04c87b489231ae708c84a77dc8e9ee176fd2
> output of 'openssl md5 file':
> SHA1(httpd-2.2.14.tar.bz2)= eacd04c87b489231ae708c84a77dc8e9ee176fd2
>
> I think that it cant be hard to make md5sum and sha1sum accept the
> openssl format too.

But it's even easier to convert openssl's format
into one that is recognized.  Filter it through this:

    sed 's/(/ (/;s/\(= [0-9a-f]*\)$/ \1/'

E.g.,

    $ touch f; openssl md5 f
    MD5(f)= d41d8cd98f00b204e9800998ecf8427e
    $ openssl md5 f | sed 's/(/ (/;s/\(= [0-9a-f]*\)$/ \1/'
    MD5 (f) = d41d8cd98f00b204e9800998ecf8427e




reply via email to

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