cksum entire dir??

Waitman Gobble gobble.wa at gmail.com
Thu Sep 13 00:42:45 UTC 2012


On Wed, Sep 12, 2012 at 5:32 PM, Gary Kline <kline at thought.org> wrote:

> On Wed, Sep 12, 2012 at 03:58:00PM -0700, Waitman Gobble wrote:
> > On Wed, Sep 12, 2012 at 3:22 PM, Gary Kline <kline at thought.org> wrote:
> >
> > > On Wed, Sep 12, 2012 at 02:31:16PM -0400, Mike Jeays wrote:
> > > > On Wed, 12 Sep 2012 10:55:57 -0700
> > > > Waitman Gobble <gobble.wa at gmail.com> wrote:
> > > >
> > > > > On Wed, Sep 12, 2012 at 10:46 AM, Gary Kline <kline at thought.org>
> > > wrote:
> > > > >
> > >         [[ ...]]
> > > >
> > > > My Linux system has both md5sum and md5deep. They give the same
> result,
> > > except that md5sum quotes the file name in the current directory, and
> > > md5deep gives the fully-qualified name. I have been using md5deep - I
> > > didn't know md5sum existed.
> > >
> > > I did a yum install md5* and got deep! :_)
> > >
> > > t.y
> > >
> > > > _______________________________________________
> > > > freebsd-questions at freebsd.org mailing list
> > > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > > To unsubscribe, send any mail to "
> > > freebsd-questions-unsubscribe at freebsd.org"
> > > _______________________________________________
> > > freebsd-questions at freebsd.org mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to "
> > > freebsd-questions-unsubscribe at freebsd.org"
> > >
> >
> >
> >
> > also "maybe???" of interest.. it's pretty quick & easy to hack the 'find'
> > function in /usr/src/usr.bin/find/ with md5 capability..
> > not sure if it's helpful..
> >
> >
> > copy /usr/src/usr.bin/find/ somewhere, then edit function.c,
> >
> > #include <md5.h>
> >
> > int
> > f_print(PLAN *plan __unused, FTSENT *entry)
> > {
> >         char * md5sum[32];
> >         (void)printf("%s ",MD5File(entry->fts_accpath,md5sum));
> >         (void)puts(entry->fts_path);
> >         return 1;
> > }
> >
> >
> > and edit Makefile (change exec name,
> >
> > PROG=   md5find
> > LDADD+= -lmd
> >
> > then "make"..
> >
> > run it:
> >
> > ./md5find .
> > 224df9d178aa35cb532664ea37875791 .
> > bfe464b3ac942e85d8b818a9441e2286 ./find.o
> > 0fc28847bb344166ff0f7f4c12d6e4ed ./Makefile
> > beb4c49ba914f62da0b57b16778c1772 ./extern.h
> > 8895f62adaa15b194dec6f15e4c5956b ./find.1
> > 8d3986a5e8747ae89b3c5f82f22bc402 ./find.c
> > 99fade54bb9baf0d3b4d8822d53800b3 ./find.h
> > 23f43527a2bdc3abf1e8eaa1aca68f26 ./function.c
> > 1d25eb09d42261b28cc783a6b48e39ac ./getdate.y
> > fce6f5ec314eaea09170b79a0711d07e ./ls.c
> > 75d64926376a5440b7e23b295417a6cc ./main.c
> > 2599f1f22d557b076ff1cde9b17cff55 ./misc.c
> > 2c4e3bb00a37b839d9ac0dc0e12a88bc ./operator.c
> > 3157efe1ed3821e96fec71f1ca4b2306 ./option.c
> > 7ea8adb4cb549b118b903238f43afd37 ./function.o
> > 12f6a75a82f817e1306c323fdddbff59 ./ls.o
> > e97d015d2e5fbeb3fdff4fa22b76f0e2 ./main.o
> > 2a5100f2c5ed4c9408ab51d6e2a848cc ./misc.o
> > 6360e963e0f285fe3dc170309a2ae219 ./operator.o
> > 68c47f622cb1d4d8f58ff7b2ef2c8312 ./option.o
> > 47a8978565c6cb8b0280c231679847ba ./getdate.c
> > 7eb3a4e4984e4696347501eeba2e0566 ./getdate.o
> > e406e4422cf29f3b42484596524b71c1 ./find
> > e3ea95347aa5efd7030103536c23a8d3 ./find.1.gz
> > 4b1fd4eb69577f53bd97d8cd2159c8eb ./md5find
> > 03d161fcb84fb38aad6ccd8ce0cafeaf ./testdir
> > 8d3986a5e8747ae89b3c5f82f22bc402 ./testdir/find.c
> >
> >
> > ....etc
> >
> > Waitman Gobble
> > San Jose California
> > _______________________________________________
> > freebsd-questions at freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
> o
>         where, Sir, is the header?!
>
> which header?

this example I just copied /usr/src/usr.bin/find/ (entire directory
contents) to my home directory then "added".

#include <md5.h> to the top of function.c (with the other includes, order
/may/ matter.. i did after the sys/ includes but before the others)

md5.h is in /usr/include, it's basically a wrapper around
/usr/include/sys/md5.h


then changed the function int f_print, added two lines
char * md5sum[32];
        (void)printf("%s ",MD5File(entry->fts_accpath,md5sum));

then changed the two lines in Makefile, PROGNAME so i don't end up with
'find' executable and the other is -lmd so i get the library with md5
routines.

I think maybe I wasn't clear that i was editing function.c, and that there
is more to function.c than my example code.

I can put the source on git if you want, but it's pretty basic. Also i'd
have to research the second parameter in MD5File function, i don't actually
think that's what i thought it was. it is returning the correct hash, and
printing it out, as returned from the function.

Waitman Gobble
San Jose California


More information about the freebsd-questions mailing list