Fixed #21253 -- PBKDF2 with cached HMAC key

This gives a 2x speed increase compared to the existing implementation.

rebased from https://github.com/django/django/pull/1638

https://code.djangoproject.com/ticket/21253