Hi - just wanted to add a note to say that this code is really old, and was written when I was in the first few months of my foundation year at University. The code is not going to be efficient, I have no idea if it's secure, and frankly, it's not nearly important enough for me to go back and work on it further.
All of that said, it does work! ...mostly.