diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-07-17 05:45:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-07-17 05:45:03 +0000 |
commit | 09fb8344523bd7e812d654701e0ffae48349b096 (patch) | |
tree | 650058f4eab36324697d0167fad026be11385a0c | |
parent | 92607bc69fae9b6a95874cdb156a562fadc96152 (diff) |
Adds rmd160 functionality.
-rw-r--r-- | bin/md5/Makefile | 7 | ||||
-rw-r--r-- | bin/md5/md5.c | 24 | ||||
-rw-r--r-- | bin/md5/rmd160.1 | 60 |
3 files changed, 76 insertions, 15 deletions
diff --git a/bin/md5/Makefile b/bin/md5/Makefile index 14215dc68aa..0c8a5ebdc48 100644 --- a/bin/md5/Makefile +++ b/bin/md5/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.4 1997/07/12 21:09:01 millert Exp $ +# $OpenBSD: Makefile,v 1.5 1997/07/17 05:45:01 millert Exp $ PROG= md5 -MAN= md5.1 sha1.1 -LINKS= ${BINDIR}/md5 ${BINDIR}/sha1 +MAN= md5.1 sha1.1 rmd160.1 +LINKS= ${BINDIR}/md5 ${BINDIR}/sha1 \ + ${BINDIR}/md5 ${BINDIR}/rmd160 COPTS+= -Wall -Wconversion -Wmissing-prototypes -Werror .include <bsd.prog.mk> diff --git a/bin/md5/md5.c b/bin/md5/md5.c index ca30fe5fe53..a81e92a5bab 100644 --- a/bin/md5/md5.c +++ b/bin/md5/md5.c @@ -1,5 +1,5 @@ /* - * $OpenBSD: md5.c,v 1.5 1997/07/12 21:09:02 millert Exp $ + * $OpenBSD: md5.c,v 1.6 1997/07/17 05:45:01 millert Exp $ * * Derived from: * MDDRIVER.C - test driver for MD2, MD4 and MD5 @@ -24,9 +24,9 @@ #include <time.h> #include <string.h> -#include <md4.h> #include <md5.h> #include <sha1.h> +#include <rmd160.h> /* * Length of test block, number of test blocks. @@ -73,7 +73,16 @@ main(argc, argv) void *context; /* What were we called as? Default to md5 */ - if (strcmp(__progname, "sha1") == 0) { + if (strcmp(__progname, "rmd160") == 0) { + MDType = "RMD160"; + MDInit = RMD160Init; + MDUpdate = RMD160Update; + MDEnd = RMD160End; + MDFile = RMD160File; + MDData = RMD160Data; + if ((context = malloc(sizeof(RMD160_CTX))) == NULL) + err(1, "malloc"); + } else if (strcmp(__progname, "sha1") == 0) { MDType = "SHA1"; MDInit = SHA1Init; MDUpdate = SHA1Update; @@ -82,15 +91,6 @@ main(argc, argv) MDData = SHA1Data; if ((context = malloc(sizeof(SHA1_CTX))) == NULL) err(1, "malloc"); - } else if (strcmp(__progname, "md4") == 0) { - MDType = "MD4"; - MDInit = MD4Init; - MDUpdate = MD4Update; - MDEnd = MD4End; - MDFile = MD4File; - MDData = MD4Data; - if ((context = malloc(sizeof(MD4_CTX))) == NULL) - err(1, "malloc"); } else { MDType = "MD5"; MDInit = MD5Init; diff --git a/bin/md5/rmd160.1 b/bin/md5/rmd160.1 new file mode 100644 index 00000000000..016a9331905 --- /dev/null +++ b/bin/md5/rmd160.1 @@ -0,0 +1,60 @@ +.\" $OpenBSD: rmd160.1,v 1.1 1997/07/17 05:45:02 millert Exp $ +.\" +.Dd July 16, 1997 +.Dt RMD160 1 +.Os +.Sh NAME +.Nm rmd160 +.Nd "calculate a message-digest fingerprint (checksum) for a file" +.Sh SYNOPSIS +.Nm +.Op Fl p +.Op Fl t +.Op Fl x +.Op Fl s Ns Ar string +.Op Ar filename(s) +.Sh DESCRIPTION +.Nm +takes as input a message of arbitrary length and produces +as output a 160-bit "fingerprint" or "message digest" of the input. +It is conjectured that it is computationally infeasible to produce +two messages having the same message digest, or to produce any +message having a given prespecified target message digest. +The +.Em RMD-160 +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 +.Em RSA . +.Sh OPTIONS +The following four options may be used in any combination, except +that +.Ar filename(s) +must be the last objects on the command line. +.Bl -tag -width "filename(s)" +.It Fl s Ns Ar string +prints a checksum of the given string. +.It Fl p +echos stdin to stdout and appends the +.Em RMD-160 +sum to stdout. +.It Fl t +runs a built-in time trial. +.It Fl x +runs a built-in test script. +.It Ar filename(s) +prints the checksum for each file. If no files are specified, +standard input is used. +.El +.Sh SEE ALSO +.Xr cksum 1 , +.Xr md5 1 +.Xr rmd160 1 +.Pp +RMD-160 is part of the ISO draft standard +.St "ISO/IEC DIS 10118-3" +on dedicated hash functions. +.Sh ACKNOWLEDGEMENTS +This program is placed in the public domain for free general use by +RSA Data Security. |