Hi Patrick,

> I would normally have reached for diff(1) for a direct comparision
> between two files, out of familiarity.

diff(1) will do for comparing binary files, but GNU diff's heuristic for
determining if the files are binary can be misled so instead of the
normal ‘Binary files foo and bar differ’ one gets confusing output.

    $ wc foo bar
      993  3069 27568 foo
      993  3069 27568 bar
     1986  6138 55136 total
    $
    $ diff foo bar
    993c993
    < abcdef
    ---
    > abcdef
    $
    $ diff foo bar | sed -n l
    993c993$
    < abc\000def$
    ---$
    > abc\adef$
    $
    $ cmp -l foo bar
    27564   0   7
    $

> Thanks for cluing me in to b2sum.

It has a nice -l option for when a shorter digest is required.

    $ for n in {3..9}; do
    >     b2sum -l $((2**n)) </dev/null
    > done
    2e  -
    b1fe  -
    1271cf25  -
    e4a6a0577479b2b4  -
    cae66941d9efbd404e4d88758ea67670  -
    0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8  -
    
786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce
  -
    $

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2020-10-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to