data such as a source IP address or a visitor identifier in a URL
parameter.
+ crc32 this is the most common CRC32 implementation as used in Ethernet,
+ gzip, PNG, etc. It is slower than the other ones but may provide
+ a better distribution or less predictable results especially when
+ used on strings.
+
<modifier> indicates an optional method applied after hashing the key :
avalanche This directive indicates that the result from the hash
#define BE_LB_HFCN_SDBM 0x000000 /* sdbm hash */
#define BE_LB_HFCN_DJB2 0x400000 /* djb2 hash */
#define BE_LB_HFCN_WT6 0x800000 /* wt6 hash */
+#define BE_LB_HFCN_CRC32 0xC00000 /* crc32 hash */
#define BE_LB_HASH_FUNC 0xC00000 /* get/clear hash function */
case BE_LB_HFCN_WT6:
hash = hash_wt6(key, len);
break;
+ case BE_LB_HFCN_CRC32:
+ hash = hash_crc32(key, len);
+ break;
case BE_LB_HFCN_SDBM:
/* this is the default hash function */
default:
}
else if (!strcmp(args[2], "djb2")) {
curproxy->lbprm.algo |= BE_LB_HFCN_DJB2;
- } else if (!strcmp(args[2], "wt6")) {
+ }
+ else if (!strcmp(args[2], "wt6")) {
curproxy->lbprm.algo |= BE_LB_HFCN_WT6;
}
+ else if (!strcmp(args[2], "crc32")) {
+ curproxy->lbprm.algo |= BE_LB_HFCN_CRC32;
+ }
else {
- Alert("parsing [%s:%d] : '%s' only supports 'sdbm', 'djb2' or 'wt6' hash functions.\n", file, linenum, args[0]);
+ Alert("parsing [%s:%d] : '%s' only supports 'sdbm', 'djb2', 'crc32', or 'wt6' hash functions.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}