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.

I am choosing to document sha256 as the primary example, leaving the
others as exercises for the reader. But I'm using the md5.1 page
because the code is still in md5.c. Once installed as hardlinks,
there's no way to tell.

Index: Makefile
===================================================================
RCS file: /cvs/src/bin/md5/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile    23 Dec 2013 23:00:38 -0000      1.12
+++ Makefile    10 Jan 2014 15:11:39 -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 -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 ...
 .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.
@@ -96,20 +93,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

Reply via email to