diff options
| author | Paul McMillan <Paul@McMillan.ws> | 2011-12-30 20:35:44 +0000 |
|---|---|---|
| committer | Paul McMillan <Paul@McMillan.ws> | 2011-12-30 20:35:44 +0000 |
| commit | 1fed65224f2b5912f8d28cf6de47577f287088e9 (patch) | |
| tree | 0d1b5884862873c4326ad86b1f32c346a3fe3840 | |
| parent | ffb0519d44dbf6254f0c0600397d901d207be839 (diff) | |
Increased pbkdf2 scaling test vectors to lower chance of false test failures.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17308 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | tests/regressiontests/utils/crypto.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/regressiontests/utils/crypto.py b/tests/regressiontests/utils/crypto.py index 5c861c6357..7889ddd43f 100644 --- a/tests/regressiontests/utils/crypto.py +++ b/tests/regressiontests/utils/crypto.py @@ -125,9 +125,11 @@ class TestUtilsCryptoPBKDF2(unittest.TestCase): Theory: If you run with 100 iterations, it should take 100 times as long as running with 1 iteration. """ - n1, n2 = 100, 10000 + n1, n2 = 1000, 100000 elapsed = lambda f: timeit.Timer(f, 'from django.utils.crypto import pbkdf2').timeit(number=1) t1 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n1) t2 = elapsed('pbkdf2("password", "salt", iterations=%d)' % n2) measured_scale_exponent = math.log(t2 / t1, n2 / n1) + #This should be less than 1. We allow up to 1.1 so that tests don't + #fail nondeterministically too often. self.assertLess(measured_scale_exponent, 1.1) |
