-# $OpenBSD: Makefile,v 1.11 2010/07/12 23:16:55 tedu Exp $
+# $OpenBSD: Makefile,v 1.12 2013/12/23 23:00:38 tedu Exp $
PROG= md5
SRCS= crc.c md5.c
MAN= cksum.1 md5.1 sha1.1 sha256.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
CPPFLAGS+= -I${.CURDIR}
COPTS+= -Wall -Wconversion -Wmissing-prototypes
-/* $OpenBSD: md5.c,v 1.57 2013/11/21 15:54:45 deraadt Exp $ */
+/* $OpenBSD: md5.c,v 1.58 2013/12/23 23:00:38 tedu Exp $ */
/*
* Copyright (c) 2001,2003,2005-2006 Todd C. Miller <Todd.Miller@courtesan.com>
enum program_mode {
MODE_MD5,
- MODE_SHA1,
- MODE_RMD160,
MODE_CKSUM,
- MODE_SUM
} pmode;
union ANY_CTX {
int fl, error, base64;
int bflag, cflag, pflag, rflag, tflag, xflag;
- static const char *optstr[5] = {
+ static const char *optstr[2] = {
"bcpqrs:tx",
- "bcpqrs:tx",
- "bcpqrs:tx",
- "a:bco:pqrs:tx",
"a:bco:pqrs:tx"
};
error = bflag = cflag = pflag = qflag = rflag = tflag = xflag = 0;
pmode = MODE_MD5;
- if (strcmp(__progname, "md5") == 0)
- pmode = MODE_MD5;
- else if (strcmp(__progname, "sha1") == 0)
- pmode = MODE_SHA1;
- else if (strcmp(__progname, "rmd160") == 0)
- pmode = MODE_RMD160;
- else if (strcmp(__progname, "cksum") == 0)
+ if (strcmp(__progname, "cksum") == 0 || strcmp(__progname, "sum") == 0)
pmode = MODE_CKSUM;
- else if (strcmp(__progname, "sum") == 0)
- pmode = MODE_SUM;
/* Check for -b option early since it changes behavior. */
while ((fl = getopt(argc, argv, optstr[pmode])) != -1) {
{
switch (pmode) {
case MODE_MD5:
- case MODE_SHA1:
- case MODE_RMD160:
fprintf(stderr, "usage: %s [-bpqrtx] [-c [checklist ...]] "
"[-s string] [file ...]\n", __progname);
break;
case MODE_CKSUM:
- case MODE_SUM:
fprintf(stderr, "usage: %s [-bpqrtx] [-a algorithms] "
"[-c [checklist ...]] [-o 1 | 2]\n"
" %*s [-s string] [file ...]\n",
-.\" $OpenBSD: sha256.1,v 1.5 2012/07/08 15:58:23 naddy Exp $
+.\" $OpenBSD: sha256.1,v 1.6 2013/12/23 23:00:38 tedu Exp $
.\"
.\" Copyright (c) 2003, 2004, 2006 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
-.Dd $Mdocdate: July 8 2012 $
+.Dd $Mdocdate: December 23 2013 $
.Dt SHA256 1
.Os
.Sh NAME
.Op Fl c Op Ar checklist ...
.Op Fl s Ar string
.Op Ar
+.Nm sha512
+.Op Fl bpqrtx
+.Op Fl c Op Ar checklist ...
+.Op Fl s Ar string
+.Op Ar
.Sh DESCRIPTION
.Nm
takes as input a message of arbitrary length and produces
such as
.Em RSA .
.Pp
+When invoked as
+.Nm sha512 ,
+the
+.Em SHA-512
+algorithm is used instead, generating a 512-bit digest.
+.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl b