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

Re: sha1summ of complete directory?



On Mon, Jul 06, 2009 at 07:30:19PM -0500, Ron Johnson <ron.l.johnson@cox.net> was heard to say:
>
> How would one go about computing a *single* hash value for a complete 
> directory tree?

  Depending on how important uniqueness is, you could just cat the
whole thing (sorting filenames first, of course) and pipe it to your
favorite cryptographic hash.  Whether that's good enough obviously
depends on what you're trying to do.  You could tag on a list of file
names and file sizes, although if it's important to be super-correct
you'll need a way of uniquely identifying where filenames stop and
where the list stops (NUL is probably your friend there) and you'll
want to normalize white-space.

  Daniel


Reply to: