<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import , division , print_function , with_statement , unicode_literals <EOL> import os <EOL> import binascii <EOL> import hashlib <EOL> from tornado import escape <EOL> from . middleware import * <EOL> from . options import * <EOL> from . tests import * <EOL> def random_hex ( length ) : <EOL> """<STR_LIT>""" <EOL> return escape . to_unicode ( binascii . hexlify ( os . urandom ( length ) ) [ length : ] ) <EOL> def password_hash ( password , password_salt = None ) : <EOL> """<STR_LIT>""" <EOL> password_salt = password_salt or oz . settings [ "<STR_LIT>" ] <EOL> salted_password = password_salt + password <EOL> return "<STR_LIT>" % hashlib . sha256 ( salted_password . encode ( "<STR_LIT:utf-8>" ) ) . hexdigest ( ) </s>
