projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Incompatible change! Add new signature schemes. Key now implies
[u/mdw/catacomb]
/
hashsum.c
diff --git
a/hashsum.c
b/hashsum.c
index
0776ee8
..
11a5d37
100644
(file)
--- a/
hashsum.c
+++ b/
hashsum.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: hashsum.c,v 1.
7 2001/02/21 20:03:22
mdw Exp $
+ * $Id: hashsum.c,v 1.
9 2004/04/04 19:42:59
mdw Exp $
*
* Hash files using some secure hash function
*
*
* Hash files using some secure hash function
*
@@
-30,6
+30,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: hashsum.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: hashsum.c,v $
+ * Revision 1.9 2004/04/04 19:42:59 mdw
+ * Add set -e.
+ *
+ * Revision 1.8 2001/04/19 18:26:33 mdw
+ * Add CRC as another hash function.
+ *
* Revision 1.7 2001/02/21 20:03:22 mdw
* Added support for MD2 hash function.
*
* Revision 1.7 2001/02/21 20:03:22 mdw
* Added support for MD2 hash function.
*
@@
-76,29
+82,8
@@
#include "ghash.h"
#include "ghash.h"
-#include "md2.h"
-#include "md4.h"
-#include "md5.h"
-#include "rmd128.h"
-#include "rmd160.h"
-#include "rmd256.h"
-#include "rmd320.h"
-#include "sha.h"
-#include "sha256.h"
-#include "sha384.h"
-#include "sha512.h"
-#include "tiger.h"
-
/*----- Static variables --------------------------------------------------*/
/*----- Static variables --------------------------------------------------*/
-static const gchash *hashtab[] = {
- &md5, &md4, &md2,
- &sha, &sha256, &sha384, &sha512,
- &rmd128, &rmd160, &rmd256, &rmd320,
- &tiger,
- 0
-};
-
#define f_binary 1u
#define f_bogus 2u
#define f_verbose 4u
#define f_binary 1u
#define f_bogus 2u
#define f_verbose 4u
@@
-208,9
+193,9
@@
static size_t gethex(const char *p, octet *q, size_t sz, char **pp)
static const gchash *gethash(const char *name)
{
static const gchash *gethash(const char *name)
{
- const gchash **g, *gg = 0;
+ const gchash *
const
*g, *gg = 0;
size_t sz = strlen(name);
size_t sz = strlen(name);
- for (g = hashtab; *g; g++) {
+ for (g =
g
hashtab; *g; g++) {
if (strncmp(name, (*g)->name, sz) == 0) {
if ((*g)->name[sz] == 0) {
gg = *g;
if (strncmp(name, (*g)->name, sz) == 0) {
if ((*g)->name[sz] == 0) {
gg = *g;
@@
-614,7
+599,7
@@
int main(int argc, char *argv[])
gch = gethash(q);
}
if (!gch)
gch = gethash(q);
}
if (!gch)
- gch =
hashtab[0]
;
+ gch =
gethash("md5")
;
xfree(q);
}
xfree(q);
}
@@
-662,10
+647,10
@@
int main(int argc, char *argv[])
break;
case 'l': {
unsigned j;
break;
case 'l': {
unsigned j;
- for (j = 0; hashtab[j]; j++) {
+ for (j = 0;
g
hashtab[j]; j++) {
if (j)
fputc(' ', stdout);
if (j)
fputc(' ', stdout);
- printf("%s", hashtab[j]->name);
+ printf("%s",
g
hashtab[j]->name);
}
fputc('\n', stdout);
exit(0);
}
fputc('\n', stdout);
exit(0);