-.\" $OpenBSD: cksum.1,v 1.27 2014/01/08 16:12:44 jmc Exp $
+.\" $OpenBSD: cksum.1,v 1.28 2014/01/10 20:14:08 jmc Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)cksum.1 8.2 (Berkeley) 4/28/95
.\"
-.Dd $Mdocdate: January 8 2014 $
+.Dd $Mdocdate: January 10 2014 $
.Dt CKSUM 1
.Os
.Sh NAME
.Sh SYNOPSIS
.Nm cksum
.Bk -words
-.Op Fl bpqrtx
+.Op Fl bcpqrtx
.Op Fl a Ar algorithms
-.Op Fl c Op Ar checklist ...
.Op Fl h Ar hashfile
.Op Fl o Ar 1 | 2
.Op Fl s Ar string
.Op Ar
.Ek
.Nm sum
-.Op Fl bpqrtx
+.Op Fl bcpqrtx
.Op Fl a Ar algorithms
-.Op Fl c Op Ar checklist ...
.Op Fl h Ar hashfile
.Op Fl o Ar 1 | 2
.Op Fl s Ar string
and
.Ar sysvsum
algorithms, which do not use hexadecimal output.
-.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.
+Each checklist should contain hash results in the normal format,
+which will be verified against the specified paths.
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.
utilities exit 0 on success,
and >0 if an error occurs.
.Sh SEE ALSO
-.Xr md5 1 ,
-.Xr sha1 1 ,
-.Xr sha256 1
+.Xr md5 1
.Pp
The default calculation is identical to that given in pseudo-code
in the following ACM article:
-.\" $OpenBSD: md5.1,v 1.39 2014/01/10 18:52:22 lteo Exp $
+.\" $OpenBSD: md5.1,v 1.40 2014/01/10 20:14:08 jmc Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.Nd calculate a message digest (checksum) for a file
.Sh SYNOPSIS
.Nm md5
-.Op Fl bcprtx
+.Op Fl bcpqrtx
.Op Fl h Ar hashfile
.Op Fl s Ar string
.Op Ar
.Nm sha1
-.Op Fl bcprtx
+.Op Fl bcpqrtx
.Op Fl h Ar hashfile
.Op Fl s Ar string
.Op Ar
.Nm sha256
-.Op Fl bcprtx
+.Op Fl bcpqrtx
.Op Fl h Ar hashfile
.Op Fl s Ar string
.Op Ar
.Nm sha512
-.Op Fl bcprtx
+.Op Fl bcpqrtx
.Op Fl h Ar hashfile
.Op Fl s Ar string
.Op Ar
.It Fl x
Runs a built-in test script.
.El
-.Pp
-The checksum of each file listed on the command line is printed
-after the options are processed.
-.Pp
-The
-.Nm
-command is shorthand for:
-.Bd -literal -offset indent
-$ cksum -a md5
-.Ed
.Sh EXIT STATUS
-.Ex -std md5
+These utilities exit 0 on success,
+and \*(Gt0 if an error occurs.
.Sh SEE ALSO
.Xr cksum 1
.Sh STANDARDS
.%O FIPS PUB 180-2
.Re
.Sh CAVEATS
-Since collisions have been found for
-.Em MD5 ,
+Since collisions have been found for MD5,
the use of
-.Xr sha256 1
+.Nm sha256
is recommended instead.
-/* $OpenBSD: md5.c,v 1.66 2014/01/10 18:51:05 lteo Exp $ */
+/* $OpenBSD: md5.c,v 1.67 2014/01/10 20:14:08 jmc Exp $ */
/*
* Copyright (c) 2001,2003,2005-2007,2010,2013,2014
{
#if !defined(SMALL)
if (strcmp(__progname, "cksum") == 0 || strcmp(__progname, "sum") == 0)
- fprintf(stderr, "usage: %s [-bpqrtx] [-a algorithms] "
- "[-c [checklist ...]] [-h hashfile]\n"
- " %*s [-o 1 | 2] [-s string] [file ...]\n",
- __progname, (int)strlen(__progname), "");
+ fprintf(stderr, "usage: %s [-bcpqrtx] [-a algorithms] "
+ "[-h hashfile] [-o 1 | 2] [-s string]\n"
+ " [file ...]\n",
+ __progname);
else
#endif /* !defined(SMALL) */
fprintf(stderr, "usage:"
- "\t%s [-bprtx] [-h hashfile] [-s string] [file ...]\n"
- "\t%s [-q] -c [checklist ...]\n",
- __progname, __progname);
+ "\t%s [-bcpqrtx] [-h hashfile] [-s string] [file ...]\n",
+ __progname);
exit(EXIT_FAILURE);
}