Add htpasswd bcrypt support

Also refactor the APR1 implementation.