00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
#include "pl_hash_fun.h"
00037
00038
namespace PLearn {
00039
using namespace std;
00040
00041
00042 const size_t
PL_HASH_NOMBRES_MAGIQUES[256]=
00043 {
00044 0x00000000,0x09823b6e,0x130476dc,0x1a864db2,0x2608edb8,0x2f8ad6d6,0x350c9b64,0x3c8ea00a,
00045 0x4c11db70,0x4593e01e,0x5f15adac,0x569796c2,0x6a1936c8,0x639b0da6,0x791d4014,0x709f7b7a,
00046 0x9823b6e0,0x91a18d8e,0x8b27c03c,0x82a5fb52,0xbe2b5b58,0xb7a96036,0xad2f2d84,0xa4ad16ea,
00047 0xd4326d90,0xddb056fe,0xc7361b4c,0xceb42022,0xf23a8028,0xfbb8bb46,0xe13ef6f4,0xe8bccd9a,
00048 0x39c556ae,0x30476dc0,0x2ac12072,0x23431b1c,0x1fcdbb16,0x164f8078,0x0cc9cdca,0x054bf6a4,
00049 0x75d48dde,0x7c56b6b0,0x66d0fb02,0x6f52c06c,0x53dc6066,0x5a5e5b08,0x40d816ba,0x495a2dd4,
00050 0xa1e6e04e,0xa864db20,0xb2e29692,0xbb60adfc,0x87ee0df6,0x8e6c3698,0x94ea7b2a,0x9d684044,
00051 0xedf73b3e,0xe4750050,0xfef34de2,0xf771768c,0xcbffd686,0xc27dede8,0xd8fba05a,0xd1799b34,
00052 0x738aad5c,0x7a089632,0x608edb80,0x690ce0ee,0x558240e4,0x5c007b8a,0x46863638,0x4f040d56,
00053 0x3f9b762c,0x36194d42,0x2c9f00f0,0x251d3b9e,0x19939b94,0x1011a0fa,0x0a97ed48,0x0315d626,
00054 0xeba91bbc,0xe22b20d2,0xf8ad6d60,0xf12f560e,0xcda1f604,0xc423cd6a,0xdea580d8,0xd727bbb6,
00055 0xa7b8c0cc,0xae3afba2,0xb4bcb610,0xbd3e8d7e,0x81b02d74,0x8832161a,0x92b45ba8,0x9b3660c6,
00056 0x4a4ffbf2,0x43cdc09c,0x594b8d2e,0x50c9b640,0x6c47164a,0x65c52d24,0x7f436096,0x76c15bf8,
00057 0x065e2082,0x0fdc1bec,0x155a565e,0x1cd86d30,0x2056cd3a,0x29d4f654,0x3352bbe6,0x3ad08088,
00058 0xd26c4d12,0xdbee767c,0xc1683bce,0xc8ea00a0,0xf464a0aa,0xfde69bc4,0xe760d676,0xeee2ed18,
00059 0x9e7d9662,0x97ffad0c,0x8d79e0be,0x84fbdbd0,0xb8757bda,0xb1f740b4,0xab710d06,0xa2f33668,
00060 0xe7155ab8,0xee9761d6,0xf4112c64,0xfd93170a,0xc11db700,0xc89f8c6e,0xd219c1dc,0xdb9bfab2,
00061 0xab0481c8,0xa286baa6,0xb800f714,0xb182cc7a,0x8d0c6c70,0x848e571e,0x9e081aac,0x978a21c2,
00062 0x7f36ec58,0x76b4d736,0x6c329a84,0x65b0a1ea,0x593e01e0,0x50bc3a8e,0x4a3a773c,0x43b84c52,
00063 0x33273728,0x3aa50c46,0x202341f4,0x29a17a9a,0x152fda90,0x1cade1fe,0x062bac4c,0x0fa99722,
00064 0xded00c16,0xd7523778,0xcdd47aca,0xc45641a4,0xf8d8e1ae,0xf15adac0,0xebdc9772,0xe25eac1c,
00065 0x92c1d766,0x9b43ec08,0x81c5a1ba,0x88479ad4,0xb4c93ade,0xbd4b01b0,0xa7cd4c02,0xae4f776c,
00066 0x46f3baf6,0x4f718198,0x55f7cc2a,0x5c75f744,0x60fb574e,0x69796c20,0x73ff2192,0x7a7d1afc,
00067 0x0ae26186,0x03605ae8,0x19e6175a,0x10642c34,0x2cea8c3e,0x2568b750,0x3feefae2,0x366cc18c,
00068 0x949ff7e4,0x9d1dcc8a,0x879b8138,0x8e19ba56,0xb2971a5c,0xbb152132,0xa1936c80,0xa81157ee,
00069 0xd88e2c94,0xd10c17fa,0xcb8a5a48,0xc2086126,0xfe86c12c,0xf704fa42,0xed82b7f0,0xe4008c9e,
00070 0x0cbc4104,0x053e7a6a,0x1fb837d8,0x163a0cb6,0x2ab4acbc,0x233697d2,0x39b0da60,0x3032e10e,
00071 0x40ad9a74,0x492fa11a,0x53a9eca8,0x5a2bd7c6,0x66a577cc,0x6f274ca2,0x75a10110,0x7c233a7e,
00072 0xad5aa14a,0xa4d89a24,0xbe5ed796,0xb7dcecf8,0x8b524cf2,0x82d0779c,0x98563a2e,0x91d40140,
00073 0xe14b7a3a,0xe8c94154,0xf24f0ce6,0xfbcd3788,0xc7439782,0xcec1acec,0xd447e15e,0xddc5da30,
00074 0x357917aa,0x3cfb2cc4,0x267d6176,0x2fff5a18,0x1371fa12,0x1af3c17c,0x00758cce,0x09f7b7a0,
00075 0x7968ccda,0x70eaf7b4,0x6a6cba06,0x63ee8168,0x5f602162,0x56e21a0c,0x4c6457be,0x45e66cd0
00076 };
00077
00078 size_t
hashbytes(
const char* byte_start, size_t byte_length)
00079 {
00080
unsigned int HKey=0u;
00081
for (size_t i=0; i<byte_length; i++)
00082 {
00083
unsigned char t = (HKey >> 24);
00084 HKey = (HKey << 8) + byte_start[i];
00085 HKey ^=
PL_HASH_NOMBRES_MAGIQUES[t];
00086 }
00087
return HKey;
00088 }
00089
00090
00091 }