added support for user defined nonce_generator functions