Skip to content

Commit

Permalink
Increased pbkdf2 scaling test vectors to lower chance of false test f…
Browse files Browse the repository at this point in the history
…ailures.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17308 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
PaulM authored and PaulM committed Dec 30, 2011
1 parent bd9f1e3 commit 5f1bd6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/regressiontests/utils/crypto.py
Expand Up @@ -125,9 +125,11 @@ def test_performance_scalability(self):
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)

0 comments on commit 5f1bd6f

Please sign in to comment.