Fix wallet creation bugs related to crypto

Wallet creation (e.g. during recovery or merge) when using PyCrypto (the default) or SlowAES wasn't performing the encryption correctly resulting in a wallet that couldn't be unlocked.

Also, switched to using os.urandom wherever cryptographically secure random numbers are required as per [the Python random documentation](https://docs.python.org/2/library/random.html) which calls the default random module "completely unsuitable for cryptographic purposes."