Samba's tdbtool
root:~# tdbtool gencache.tdb tdb> keys [...] key 14 bytes: NBT/BEFS01#20 [...] tdb> show NBT/BEFS01#20 fetch failed tdb> show NBT/BEFS01#20\0 [...data...]
Or, in other words: string delimiters are part of the string, as far as samba is concerned (oh, puh'lease!)
Not everything is a string. IIRC both keys and values are chunks of data, which may contain multiple \0s and which do not necessarily end with one. Therefore, when using a string as key, you have two choices, including the \0 or not. Since most of the time you'll be storing it in a way where the \0 is appended and when accessing the value you again might want to have a trailing \0 included, I don't think there is a lot wrong here.