Project

General

Profile

Actions

Optimization #3322

open
PA CT

Use standard CRC32 for hash-like functions

Optimization #3322: Use standard CRC32 for hash-like functions

Added by Philippe Antoine over 6 years ago. Updated 2 months ago.

Status:
Assigned
Priority:
Low
Target version:
Effort:
low
Difficulty:
Label:

Description

Instead of a custom one (as CRC32 was I think designed for kind of avoiding collisions)

One such function is StringHash cf https://github.com/OISF/suricata/pull/4337


Related issues 2 (1 open1 closed)

Related to Suricata - Security #7209: thash: random factor not used; possible abusive hash collisionsClosedPhilippe AntoineActions
Blocked by Suricata - Bug #4265: QA lab: add possibility to do repeatable replay testsIn ProgressPeter ManevActions

VJ Updated by Victor Julien over 6 years ago Actions #1

As we discussed offline, it would be nice to create some kind of benchmarking framework where we could validate such changes. Pure pcap tests may not always give enough insight. For example with the bm optimizations pcap based tests showed no difference, while I think more micro level benchmarks would have shown something.

PA Updated by Philippe Antoine over 6 years ago Actions #2

It would be nice if this benchmarking framework handles caches realistically.

With the example of Boyer-Moore optimizations (one less call to alloc), I am not sure a naive benchmarking would shows much difference as the additional call to alloc would grab repeatedly the same cached memory area, whereas in a real Suricata execution, this would not be the case

AH Updated by Andreas Herz over 6 years ago Actions #3

  • Assignee set to Philippe Antoine
  • Target version set to TBD

PA Updated by Philippe Antoine over 6 years ago Actions #5

I put a first benchmark here
https://github.com/OISF/suricata/pull/4371

PA Updated by Philippe Antoine about 6 years ago Actions #6

  • Status changed from New to In Review

RF Updated by Roland Fischer almost 6 years ago Actions #7

There are a few other hash functions that might be interesting. Google's CityHash comes to mind as it's their "general purpose" hash. SpookyHash/xxhash might be options as well. The stackexchange page lists them as well I think.

Ultimately, it depends on how much time you want to spend on this vs how happy you are with the current hash. Plus, what the usage patterns of the hash are as well as the data to be hashed. ;)

VJ Updated by Victor Julien about 5 years ago Actions #8

  • Blocked by Bug #4265: QA lab: add possibility to do repeatable replay tests added

PA Updated by Philippe Antoine about 5 years ago Actions #9

PA Updated by Philippe Antoine over 3 years ago Actions #10

  • Assignee changed from Philippe Antoine to Community Ticket
  • Priority changed from Normal to Low

This does not seem the most important area to optimize...

PA Updated by Philippe Antoine over 1 year ago Actions #11

  • Status changed from In Review to New

PA Updated by Philippe Antoine over 1 year ago Actions #12

  • Related to Security #7209: thash: random factor not used; possible abusive hash collisions added

PA Updated by Philippe Antoine over 1 year ago Actions #13

SipHash seems to be the current standard, used by rust and other internally...

PA Updated by Philippe Antoine 2 months ago Actions #14

  • Status changed from New to Assigned
Actions

Also available in: PDF Atom