Replace rand function with more secure SecureRandom.hex

Standard rand function can be predictable under some edge cases or if running the function multiple times.
Using more sane default for secret key
Merge pull request #303 from drubin/patch-1

Replace rand function with more secure SecureRandom.hex