def hash_value(self, value, salt='<STR_LIT>'):
def hashit(value, salt):<EOL><INDENT>h = hashlib.new(self.algorithm)<EOL>tgt = salt+value<EOL>h.update(tgt)<EOL>return h.hexdigest()<EOL><DEDENT>def fix_unicode(value):<EOL><INDENT>if VER < <NUM_LIT:3> and isinstance(value, unicode):<EOL><INDENT>value = str(value)<EOL><DEDENT>elif VER >= <NUM_LIT:3> and isinstance(value, str):<EOL><INDENT>value = str.encode(value)<EOL><DEDENT>return value<EOL><DEDENT>salt = fix_unicode(salt)<EOL>for i in range(self.rounds):<EOL><INDENT>value = fix_unicode(value)<EOL>value = hashit(value, salt)<EOL><DEDENT>return value<EOL>
Hashes the specified value combined with the specified salt.
        The hash is done HASHING_ROUNDS times as specified by the application
        configuration.

        An example usage of :class:``hash_value`` would be::

            val_hash = hashing.hash_value('mysecretdata', salt='abcd')
            # save to a db or check against known hash

        :param value: The value we want hashed
        :param salt: The salt to use when generating the hash of ``value``. Default is ''.
        :return: The resulting hash as a string
        :rtype: str