Ticket #16943: fix-crypto-salted_hmac.patch

File fix-crypto-salted_hmac.patch, 611 bytes (added by adsworth, 13 years ago)
  • django/utils/crypto.py

    diff --git a/django/utils/crypto.py b/django/utils/crypto.py
    index 1587bfc..71113bf 100644
    a b def salted_hmac(key_salt, value, secret=None):  
    2626    # line is redundant and could be replaced by key = key_salt + secret, since
    2727    # the hmac module does the same thing for keys longer than the block size.
    2828    # However, we need to ensure that we *always* do this.
    29     return hmac.new(key, msg=value, digestmod=hashlib.sha1)
     29    return hmac.new(key, msg=b(value), digestmod=hashlib.sha1)
    3030
    3131def constant_time_compare(val1, val2):
    3232    """
Back to Top