diff --git a/tests/regressiontests/utils/crypto.py b/tests/regressiontests/utils/crypto.py
index 2bdc5ba..73a3642 100644
a
|
b
|
class TestUtilsCryptoPBKDF2(unittest.TestCase):
|
139 | 139 | # These values are chosen as a reasonable tradeoff between time |
140 | 140 | # to run the test suite and false positives caused by imprecise |
141 | 141 | # measurement. |
142 | | n1, n2 = 200000, 800000 |
143 | | elapsed = lambda f: timeit.Timer(f, |
| 142 | n1, n2 = 1000, 20000 |
| 143 | elapsed = lambda f: timeit.Timer(f, |
144 | 144 | 'from django.utils.crypto import pbkdf2').timeit(number=1) |
145 | 145 | t1 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n1) |
146 | 146 | t2 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n2) |
147 | 147 | measured_scale_exponent = math.log(t2 / t1, n2 / n1) |
148 | | # This should be less than 1. We allow up to 1.2 so that tests don't |
| 148 | # This should be less than 1. We allow up to 2.0 so that tests don't |
149 | 149 | # fail nondeterministically too often. |
150 | | self.assertLess(measured_scale_exponent, 1.2) |
| 150 | self.assertLess(measured_scale_exponent, 2.0) |