BCrypt nginx vs apache2
Choosing between apache2 and nginx for a good webDAV server, I noticed an error if I included a BCrypted password in the htpasswd file.
Looking further nginx seems to use the password function crypt(), TLDR; OpenSUSE seems to be the only one to support BCrypt on crypt() and thus on nginx.
Here's a C program to test crypt() with MD5, SHA512 & BCrypt:
#include <stdio.h>
#include <crypt.h>
int main(void) {
char *hashed;
char *cryptorandsalt[3];
char *cryptname[3];
cryptorandsalt[0] = "$1$salthere";
cryptname[0] = "MD5";
cryptorandsalt[1] = "$6$salthere";
cryptname[1] = "SHA512";
cryptorandsalt[2] = "$2a$salthere";
cryptname[2] = "bcrypt";
int i;
for( i = 0; i < 3; i = i + 1 ){
hashed = crypt("xyz", cryptorandsalt[i]);
printf("%s: %s\n", cryptname[i], hashed);
// puts(hashed);
}
return 0;
}