The default format is simply a text file where the odd lines are the itemnames and the even lines are their text data, with lines ending with $crlf. If there's an odd number of lines, it's ignoring that last line.

I'm assuming you don't want to mess with creating the file in .ini format, where additional complicated rules apply, including ;comments.

If the format is going to be &binary, that will be 1 of 2 different formats, depending on whether it's -b or -B, with -b supporting length only up to 65535. The itemnames are case-insensitive only as far as a-zA-Z, since the next example creates 26 items fewer than 65535 items:

//hfree -w test | var %i 1 | while (%i isnum 1-65535) { hadd -m test $+(item,$chr(%i)) 1 | inc %i } | echo -a $hget(test,0).item

It allows creating itemnames that can't be created from the /hadd command, and which can't be deleted due to containing a space:, unless you use a wildcard which has the potential of deleting extra items.

//write -c test.hsh item name | write test.hsh data | hfree -w test | hload -m test test.hsh | hdel -s test $hget(test,1).item | echo -a $hget(test,1).item

For -b binary format it's little-endian:

uint16 length of itemname in bytes
itemname itself
uint16 length of data
data itself

For -B binary it's the same except for the length fields being uint32's