Speed up BCrypt and PBKDF2 password hashing.

Iteration-based password hashing algorithms can be prohibitively expensive for high volume sites that rely on Basic HTTP Auth.

This change adds caching versions of the BCrypt and PBKDF2 hashers.

The motivation for this came from us trying to upgrade Bitbucket to BCrypt and DOSing ourselves in the process.