def pbkdf2(password, salt, iterations, dklen=<NUM_LIT:0>, digest=None):
if digest is None:<EOL><INDENT>digest = settings.CRYPTOGRAPHY_DIGEST<EOL><DEDENT>if not dklen:<EOL><INDENT>dklen = digest.digest_size<EOL><DEDENT>password = force_bytes(password)<EOL>salt = force_bytes(salt)<EOL>kdf = PBKDF2HMAC(<EOL>algorithm=digest,<EOL>length=dklen,<EOL>salt=salt,<EOL>iterations=iterations,<EOL>backend=settings.CRYPTOGRAPHY_BACKEND)<EOL>return kdf.derive(password)<EOL>
Implements PBKDF2 with the same API as Django's existing
implementation, using cryptography.

:type password: any
:type salt: any
:type iterations: int
:type dklen: int
:type digest: cryptography.hazmat.primitives.hashes.HashAlgorithm