What combination length best secures my key safe? I have the following key safe and need to decide upon a combination for it.

It's fairly simple mechanically with these features:-


*

*It allows the characters 0-9 and A and B (12 possible digits in total). 

*The combination can be 4 to 12 characters long.

*Each button can be used only once.

*A weirdness is that the buttons can be pressed in any order for the same code, so 1234 is the same code as 4321. 

*Once you've entered the correct code, you turn the knob to open the safe.  It doesn't spring open immediately upon correct code entry.


From the manufacturers website FAQ:-

"The C500 Police approved key safe has 4,096 possible code combinations"

It seems to me that the security /difficulty of the combination will depend on how many digits I set, but I can't figure out how many is best. Intuition suggests to me that the longest possible code is the most secure.    But. Clearly if it's 12 digits long, and they're identical in any order, there can only be 1 combination that's 12 characters long. That's not good.  Any ideas? 

The $4096$ combinations represents $2^{12}$ as each button can be part of the combination or not.  You have twelve binary choices, so multiply twelve $2$s together.  Perhaps we should delete the combination with no buttons as the lock is then always unlocked.  As long as nobody knows the length of the combination, any one of them is equally secure.  If the length of the combination is known, the best you can do is six buttons, for which there are ${12 \choose 6}=924$ choices.  Intuitively you want an equal number of buttons pressed and unpressed for the maximum.
