summaryrefslogtreecommitdiff
path: root/other/wrez/crypto-test.c
blob: c43f008b4b8576c2622b3a4dec931f4d65f5568d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "crypto.h"


int
main (int argc, char *argv[])
{
	char		hw[] = "hello world";
	unsigned int	hash;
	struct utsname	un;


	hash = mhash (hw, sizeof (hw));
	printf ("mhash(hw) = 0x%08x\n", hash);

	uname (&un);
	hash = mhash ((unsigned char *) &un, sizeof (un));
	printf ("mhash(utsname) = 0x%08x\n", hash);

	if (argc == 2) {
		hash = mhash (argv[1], strlen (argv[1]));
		printf ("mhash(\"%s\") = 0x%08x\n", argv[1], hash);
	}

	exit (EXIT_SUCCESS);
}