> On Fri, Jan 10, 2014 at 10:16, Ted Unangst wrote: > > this would have made my life so much simpler yesterday. and for > > whoever tweaks and tunes the synopsis or text to further clarity in > > the future. > > > Index: md5.1 > > =================================================================== > > RCS file: /cvs/src/bin/md5/md5.1,v > > retrieving revision 1.37 > > diff -u -p -r1.37 md5.1 > > --- md5.1 10 Jan 2014 05:34:46 -0000 1.37 > > +++ md5.1 10 Jan 2014 15:11:39 -0000 > > @@ -22,35 +22,32 @@ > > .Dt MD5 1 > > .Os > > .Sh NAME > > -.Nm md5 > > +.Nm sha256 > > .Nd calculate a message digest (checksum) for a file > > .Sh SYNOPSIS > > -.Nm md5 > > +.Nm sha256 > > .Op Fl bprtx > > .Op Fl h Ar hashfile > > .Op Fl s Ar string > > .Op Ar > > -.Nm md5 > > +.Nm sha256 > > .Op Fl q > > .Fl c Op Ar checklist ... > > +.Nm md5 | sha1 | sha512 > > +.Op options ... > > ok, this is cheating. i was trying to avoid duplication of the option > list, so that any further refinements don't need to be filled out in > quadruplicate. open to suggestions, or we just do it the hard way.
jmc is booking a fight to come murder you. How about the following. In this version, the text for the -c option still doesn't flow quite right, but it starts undoing the mess. Index: Makefile =================================================================== RCS file: /cvs/src/bin/md5/Makefile,v retrieving revision 1.12 diff -u -p -u -r1.12 Makefile --- Makefile 23 Dec 2013 23:00:38 -0000 1.12 +++ Makefile 10 Jan 2014 15:17:25 -0000 @@ -2,14 +2,16 @@ PROG= md5 SRCS= crc.c md5.c -MAN= cksum.1 md5.1 sha1.1 sha256.1 +MAN= cksum.1 md5.1 LINKS= ${BINDIR}/md5 ${BINDIR}/sha1 \ ${BINDIR}/md5 ${BINDIR}/sha256 \ ${BINDIR}/md5 ${BINDIR}/sha512 \ ${BINDIR}/md5 ${BINDIR}/cksum \ ${BINDIR}/md5 ${BINDIR}/sum MLINKS= cksum.1 sum.1 -MLINKS+= sha256.1 sha512.1 +MLINKS+= md5.1 sha1.1 +MLINKS+= md5.1 sha256.1 +MLINKS+= md5.1 sha512.1 CPPFLAGS+= -I${.CURDIR} COPTS+= -Wall -Wconversion -Wmissing-prototypes Index: md5.1 =================================================================== RCS file: /cvs/src/bin/md5/md5.1,v retrieving revision 1.37 diff -u -p -u -r1.37 md5.1 --- md5.1 10 Jan 2014 05:34:46 -0000 1.37 +++ md5.1 10 Jan 2014 15:27:06 -0000 @@ -22,42 +22,46 @@ .Dt MD5 1 .Os .Sh NAME -.Nm md5 +.Nm sha256 .Nd calculate a message digest (checksum) for a file .Sh SYNOPSIS -.Nm md5 -.Op Fl bprtx +.Nm sha256 +.Op Fl bcprtx +.Op Fl h Ar hashfile +.Op Fl s Ar string +.Op Ar +.Nm sha512 +.Op Fl bcprtx .Op Fl h Ar hashfile .Op Fl s Ar string .Op Ar .Nm md5 -.Op Fl q -.Fl c Op Ar checklist ... +.Op Fl bcprtx +.Op Fl h Ar hashfile +.Op Fl s Ar string +.Op Ar .Sh DESCRIPTION -.Nm -takes as input a message of arbitrary length and produces -as output a 128-bit message digest (checksum) of the input. +These utilities take as input a message of arbitrary length and produces +as output a message digest (checksum) of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest (a collision), or to produce any message having a given prespecified target message digest. -However, collisions have now been produced for MD5, -so the use of other message digest functions, such as -.Xr sha256 1 , -is now preferred. +The algorithm (MD5, SHA-1, SHA-256, SHA-512) is determined by the +name used to invoke the utility. .Pp -The MD5 algorithm is intended for digital signature applications, -where a large file must be compressed in a secure manner before -being encrypted with a private (secret) key under a public-key -cryptosystem, such as RSA. +Collisions have now been produced for MD5, and are theorized for SHA-1, +so their use is deprecated. .Pp -The options are as follows: +The options for use with each command are as follows: .Bl -tag -width Ds .It Fl b Output checksums in base64 notation, not hexadecimal. -.It Fl c Op Ar checklist ... -Compares all checksums contained in the file -.Ar checklist -with newly computed checksums for the corresponding files. +.It Fl c +If this option is specified, the +.Ar file +options become checklists. +All checksums listed in all files will be used to +verify the specified files. Output consists of the digest used, the file name, and an OK or FAILED for the result of the comparison. This will validate any of the supported checksums (see @@ -96,20 +100,35 @@ The .Nm command is shorthand for: .Bd -literal -offset indent -$ cksum -a md5 +$ cksum -a sha256 .Ed .Sh EXIT STATUS .Ex -std md5 .Sh SEE ALSO .Xr cksum 1 , -.Xr sha1 1 , -.Xr sha256 1 .Sh STANDARDS .Rs .%A R. Rivest .%D April 1992 .%R RFC 1321 .%T The MD5 Message-Digest Algorithm +.Re +.Rs +.%A J. Burrows +.%O FIPS PUB 180-1 +.%T The Secure Hash Standard +.Re +.Pp +.Rs +.%A D. Eastlake +.%A P. Jones +.%D September 2001 +.%R RFC 3174 +.%T US Secure Hash Algorithm 1 (SHA1) +.Re +.Rs +.%T Secure Hash Standard +.%O FIPS PUB 180-2 .Re .Sh CAVEATS Since collisions have been found for