[Top][All Lists]

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

Re: Don't you think there are too many *sum utilities?

From: Elias Pipping
Subject: Re: Don't you think there are too many *sum utilities?
Date: Mon, 9 Apr 2007 22:59:44 +0200

On Apr 9, 2007, at 2:28 PM, Eric Blake wrote:

Hash: SHA1

According to Alfred M. Szmidt on 4/9/2007 6:17 AM:
I don't see any major problem why something like `hashsum
ALGORITHM' wouldn't work though, `md5sum' could be the same as
`hashsum md5'.  And then md5sum could be a shell script, or just
a simple program that calls `hashsum md5'.

   Except that since the *sum utilities operate on arbitrary files,
   you would need it to be `hashsum --md5', ie. make the algorithm an
   option rather than the first argument.

Why not just: hashsum ALGORITHM [FILE]? A optional hashing algorithm
seems pointless for this.

Because on decoding, 'hashsum -c FILE' could be made smart enough to
auto-detect the algorithm based on the length of the hash, but only if the algorithm is optional (--md5) rather than required (md5). Currently, md5,
sha1, sha224, sha256, sha384, and sha512 all produce different hash
lengths, making this task unambiguous (but I'm not sure how long md4 is).

md2, md4 and md5 share the same length (32), as well as sha, sha1 and rmd160 (40)

  $openssl dgst -md5 coreutils-6.9.tar.bz2
  MD5(coreutils-6.9.tar.bz2)= c9607d8495f16e98906e7ed2d9751a06
  $openssl dgst -md4 coreutils-6.9.tar.bz2
  MD4(coreutils-6.9.tar.bz2)= eeb5317a341a5d1e4fa7a751dce2f979
  $openssl dgst -md2 coreutils-6.9.tar.bz2
  MD2(coreutils-6.9.tar.bz2)= f3a7bedf4cc502c76cc84eaee93283b1

  $openssl dgst -rmd160 coreutils-6.9.tar.bz2
RIPEMD160(coreutils-6.9.tar.bz2)= c6ae65204b2e9c234a1140f39a8be1ee5cdcaab7
  $openssl dgst -sha1 coreutils-6.9.tar.bz2
  SHA1(coreutils-6.9.tar.bz2)= 10310a78c4e1d9f742f3815ac28e9bf1086a5885
  $openssl dgst -sha coreutils-6.9.tar.bz2
  SHA(coreutils-6.9.tar.bz2)= 6ffdef6b4a1f055326d7b5427de1145b5e9a8da1


Elias Pipping

reply via email to

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