Refactor KeyGenerator
Use sha256 by default
Allow keys to be cached
Move secret_key_base to the connection