Almost all of this was done by reading the disassembly and no debugging tools, so some of this may change over time as more info is found.
This document primarily covers reading the password since creating a password is the exact same process, but in reverse.
Note: There are screenshots in the first comment of this gist which may be good to look at if you don't know much about the game.