[Bro-Dev] #530: Change to hashing code

Bro Tracker bro at tracker.bro-ids.org
Thu Aug 18 10:34:11 PDT 2011


#530: Change to hashing code
----------------------------+--------------------
  Reporter:  seth           |      Owner:
      Type:  Merge Request  |     Status:  new
  Priority:  Normal         |  Milestone:  Bro1.6
 Component:  Bro            |    Version:
Resolution:                 |   Keywords:  beta
----------------------------+--------------------

Comment (by jsiwek):

 In [d412aa9d636b22e65b11a9c4308fff7d9387fca8/bro]:
 {{{
 #!CommitTicketReference repository="bro"
 revision="d412aa9d636b22e65b11a9c4308fff7d9387fca8"
 Fix H3 assumption of an 8-bit byte/char.

 The hash function was internally casting the void* data argument into an
 unsigned char* and then using values from that to index another internal
 array that's dimensioned based on the assumption of 256 values possible
 for an unsigned char (8-bit chars/bytes).  This is probably a correct
 assumption most of the time, but should be safer to use the limits as
 defined in standard headers to get it right for the particular
 system/compiler.

 There was an unused uint8* casted variable in HashKey::HashBytes that
 seemed like it might have been meant to be passed to H3's hash function
 as an unfinished attempt to solve the 8-bit byte assumption problem, but
 that doesn't seem as good as taking care of that internally in H3 so
 users of the API are only concerned with byte sizes as reported by
 `sizeof`.  Removing the unused variable addresses #530.

 Also a minor tweak to an hmac_md5 call that was casting away const from
 one argument (which doesn't match the prototype).
 }}}

-- 
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/530#comment:3>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list