From BRTT
How can I make an Arr array with a binary key?
Associative arrays require a string key. That key is duplicated with strdup as part of the process of creating new entries. strdup(3c) would not work with some binary key.
It is possible to use a binary key with an Stbl(3). This interface requires that you provide a compare function, which must distinguish and uniquely order any entries. The entries can be any binary structure, but the stbl routines play no part in managing the associated memory. When you add a new stbl entry, it must be in static or newly allocated memory, not (for instance) an automatic variable or memory that is getting reused in a loop.
The corresponding compare routine for Arr associative arrays may also be replaced, but only with some different string compare routine, eg strcasecmp(3c).