<spoiler>For #1, I didn't hear correctly because I didn't understand that the clearly insane and cruel warden would let the prisoners label the boxes before hand :-/
You need a minimal perfect hash function but it's a thing that can be done, especially because prisoners in these sort of conundrums always have fantastic memories and mental math facility.
https://en.wikipedia.org/wiki/Perfect_hash_function#Minimal_...
The problem statement makes it clear they can communicate prior to starting the game.
Me: "Here's a plan that will defeat the werewolf in any case, even if I am the werewolf"
Them: "That sounds complicated, therefore suspicious, let's hang him"
If you assume the axiom of choice and allow them to memorize arbitrary uncountable elements, you can get more interesting puzzles (and also go insane).
https://cornellmath.wordpress.com/2007/09/13/the-axiom-of-ch...