  import hashlib
  import unittest
  
  from django.utils.crypto import constant_time_compare, pbkdf2, salted_hmac
  
  
  class TestUtilsCryptoMisc(unittest.TestCase):
  
      def test_constant_time_compare(self):
 
</s> remove class TestUtilsCryptoMisc(unittest.TestCase):
 </s> add class TestUtilsCryptoMisc(SimpleTestCase): </s> remove def salted_hmac(key_salt, value, secret=None):
 </s> add class InvalidAlgorithm(ValueError):
    """Algorithm is not supported by hashlib."""
    pass


def salted_hmac(key_salt, value, secret=None, *, algorithm='sha1'): </s> remove 
 </s> add     try:
        hasher = getattr(hashlib, algorithm)
    except AttributeError as e:
        raise InvalidAlgorithm(
            '%r is not an algorithm accepted by the hashlib module.'
            % algorithm
        ) from e </s> remove     Return the HMAC-SHA1 of 'value', using a key generated from key_salt and a
    secret (which defaults to settings.SECRET_KEY).
 </s> add     Return the HMAC of 'value', using a key generated from key_salt and a
    secret (which defaults to settings.SECRET_KEY). Default algorithm is SHA1,
    but any algorithm name supported by hashlib.new() can be passed.
from django.test import SimpleTestCase
from django.utils.crypto import (
    InvalidAlgorithm, constant_time_compare, pbkdf2, salted_hmac,
)
  import hashlib
  import unittest
  
from django.test import SimpleTestCase
from django.utils.crypto import (
    InvalidAlgorithm, constant_time_compare, pbkdf2, salted_hmac,
)
  
  
  class TestUtilsCryptoMisc(unittest.TestCase):
  
      def test_constant_time_compare(self):
keep keep keep replace keep keep keep keep keep
 Refs #27468 -- Added algorithm parameter to django.utils.crypto.salted_hmac(). 
tests/utils_tests/test_crypto.py