Commit Diff


commit - 28c5a21fa0d001f443bf5bba435e84b6147a578e
commit + 8a45b177ce478d466d42d59767c4e73405b616b0
blob - 2fea6f203f762418d406b65fa889901a9b7f22fb
blob + 829e8277b9aa5c8adb857826a35fffd3bf4312d3
--- MacOSX/ngircd.pbproj/project.pbxproj
+++ MacOSX/ngircd.pbproj/project.pbxproj
@@ -134,6 +134,7 @@
 				F5F18138023EC63701A85B04,
 				F5F18139023EC63701A85B04,
 				F5F1813A023EC63701A85B04,
+				F55047BC0240F6E501A85B04,
 			);
 			isa = PBXHeadersBuildPhase;
 			name = Headers;
@@ -156,6 +157,7 @@
 				F57C88880232853501A85B04,
 				F57C888C0232884501A85B04,
 				F57C889002328D7201A85B04,
+				F55047BD0240F6E501A85B04,
 			);
 			isa = PBXSourcesBuildPhase;
 			name = Sources;
@@ -425,6 +427,8 @@
 				F52162C101C7B904012300F4,
 				F51F791201DFC95301D13771,
 				F576ABFE01D61D7401A85B03,
+				F55047BA0240F6E501A85B04,
+				F55047BB0240F6E501A85B04,
 			);
 			isa = PBXGroup;
 			path = ngircd;
@@ -626,7 +630,29 @@
 			name = Makefile.am;
 			path = ../doc/Makefile.am;
 			refType = 2;
+		};
+		F55047BA0240F6E501A85B04 = {
+			isa = PBXFileReference;
+			path = hash.c;
+			refType = 4;
+		};
+		F55047BB0240F6E501A85B04 = {
+			isa = PBXFileReference;
+			path = hash.h;
+			refType = 4;
 		};
+		F55047BC0240F6E501A85B04 = {
+			fileRef = F55047BB0240F6E501A85B04;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		F55047BD0240F6E501A85B04 = {
+			fileRef = F55047BA0240F6E501A85B04;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F56D8B9E01E0BFA00155ADA7 = {
 			children = (
 				F56D8B9F01E0BFA00155ADA7,
blob - 23627272802d97325071e8531753f18ab4c82cb3
blob + 2e2b8dc61569f04f2a764a4b668386eb2cd0dcfd
--- src/ngircd/Makefile.am
+++ src/ngircd/Makefile.am
@@ -9,18 +9,18 @@
 # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 #
-# $Id: Makefile.am,v 1.16 2002/03/12 14:37:51 alex Exp $
+# $Id: Makefile.am,v 1.17 2002/03/14 15:31:22 alex Exp $
 #
 
 AM_CFLAGS = -I$(srcdir)/../portab
 
 sbin_PROGRAMS = ngircd
 
-ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c irc.c \
+ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c hash.c irc.c \
 	irc-channel.c irc-login.c irc-mode.c irc-oper.c irc-server.c \
 	irc-write.c log.c parse.c tool.c
 
-noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h irc.h \
+noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h hash.h irc.h \
 	irc-channel.h irc-login.h irc-mode.h irc-oper.h irc-server.h \
 	irc-write.h log.h parse.h tool.h \
 	messages.h defines.h
blob - /dev/null
blob + 511dba15274c17edfd335f50562f6b59866208d0 (mode 644)
--- /dev/null
+++ src/ngircd/hash.c
@@ -0,0 +1,110 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ *
+ * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
+ * der GNU General Public License (GPL), wie von der Free Software Foundation
+ * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
+ * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
+ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
+ * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
+ *
+ * $Id: hash.c,v 1.1 2002/03/14 15:31:22 alex Exp $
+ *
+ * hash.c: Hash-Werte berechnen
+ */
+
+
+#include "portab.h"
+
+#include "imp.h"
+#include <assert.h>
+
+#include "exp.h"
+#include "hash.h"
+
+
+/*
+ * Die hier verwendete Hash-Funktion stammt aus lookup2.c von Bob Jenkins
+ * (URL: <http://burtleburtle.net/bob/c/lookup2.c>). Aus dem Header:
+ * --------------------------------------------------------------------
+ * lookup2.c, by Bob Jenkins, December 1996, Public Domain.
+ * hash(), hash2(), hash3, and mix() are externally useful functions.
+ * Routines to test the hash are included if SELF_TEST is defined.
+ * You can use this free for any purpose.  It has no warranty.
+ * --------------------------------------------------------------------
+ * nicht alle seiner Funktionen werden hier genutzt.
+ */
+
+
+typedef unsigned long int ub4;
+typedef unsigned char ub1;
+
+
+#define hashsize(n) ((ub4)1<<(n))
+#define hashmask(n) (hashsize(n)-1)
+
+#define mix(a,b,c) \
+{ \
+	a -= b; a -= c; a ^= (c>>13); \
+	b -= c; b -= a; b ^= (a<<8);  \
+	c -= a; c -= b; c ^= (b>>13); \
+	a -= b; a -= c; a ^= (c>>12); \
+	b -= c; b -= a; b ^= (a<<16); \
+	c -= a; c -= b; c ^= (b>>5);  \
+	a -= b; a -= c; a ^= (c>>3);  \
+	b -= c; b -= a; b ^= (a<<10); \
+	c -= a; c -= b; c ^= (b>>15); \
+}
+
+
+ub4 hash( register ub1 *k, register ub4 length, register ub4 initval)
+{
+	/* k: the key
+	 * length: length of the key
+	 * initval: the previous hash, or an arbitrary value
+	 */
+
+	register ub4 a,b,c,len;
+
+	/* Set up the internal state */
+	len = length;
+	a = b = 0x9e3779b9;	/* the golden ratio; an arbitrary value */
+	c = initval;		/* the previous hash value */
+
+	/* handle most of the key */
+	while (len >= 12)
+	{
+		a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24));
+		b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24));
+		c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24));
+		mix(a,b,c);
+		k += 12; len -= 12;
+	}
+
+	/* handle the last 11 bytes */
+	c += length;
+	switch(len)		/* all the case statements fall through */
+	{
+		case 11: c+=((ub4)k[10]<<24);
+		case 10: c+=((ub4)k[9]<<16);
+		case 9 : c+=((ub4)k[8]<<8);
+		/* the first byte of c is reserved for the length */
+		case 8 : b+=((ub4)k[7]<<24);
+		case 7 : b+=((ub4)k[6]<<16);
+		case 6 : b+=((ub4)k[5]<<8);
+		case 5 : b+=k[4];
+		case 4 : a+=((ub4)k[3]<<24);
+		case 3 : a+=((ub4)k[2]<<16);
+		case 2 : a+=((ub4)k[1]<<8);
+		case 1 : a+=k[0];
+		/* case 0: nothing left to add */
+	}
+	mix(a,b,c);
+
+	/* report the result */
+	return c;
+} /* hash */
+
+
+/* -eof- */
blob - /dev/null
blob + 80caed892800cb869149c01e58e34ffce7d728b1 (mode 644)
--- /dev/null
+++ src/ngircd/hash.h
@@ -0,0 +1,25 @@
+/*
+ * ngIRCd -- The Next Generation IRC Daemon
+ * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ *
+ * Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
+ * der GNU General Public License (GPL), wie von der Free Software Foundation
+ * herausgegeben, weitergeben und/oder modifizieren, entweder unter Version 2
+ * der Lizenz oder (wenn Sie es wuenschen) jeder spaeteren Version.
+ * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
+ * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
+ *
+ * $Id: hash.h,v 1.1 2002/03/14 15:31:22 alex Exp $
+ *
+ * hash.h: Hash-Werte berechnen (Header)
+ */
+
+
+#ifndef __hash_h__
+#define __hash_h__
+
+
+#endif
+
+
+/* -eof- */