--- a/libbb/pw_encrypt.c
+++ b/libbb/pw_encrypt.c
@@ -57,9 +57,20 @@
 	 * Need to be case-insensitive in the code below.
 	 */
 	if ((algo[0]|0x20) != 'd') { /* not des */
-		len = 8/2; /* so far assuming md5 */
 		*salt_ptr++ = '$';
-		*salt_ptr++ = '1';
+		if(algo[0] == 'b') {
+			// blowfish
+			*salt_ptr++ = '2';
+			*salt_ptr++ = 'a';
+			*salt_ptr++ = '$';
+			// 8 rounds
+			*salt_ptr++ = '0';
+			*salt_ptr++ = '8';
+			len = 22/2;
+		} else {
+			*salt_ptr++ = '1';
+			if (algo[0] == 'm') len = 8/2; /* so far assuming md5 */
+		}
 		*salt_ptr++ = '$';
 #if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA
 		if ((algo[0]|0x20) == 's') { /* sha */
@@ -99,6 +110,11 @@
 /* Other advanced crypt ids (TODO?): */
 /* $2$ or $2a$: Blowfish */
 
+static char *bf_crypt(const char *key, const char *salt) {
+	// use musl-builtin crypt
+	return crypt(key, salt);
+}
+
 static struct const_des_ctx *des_cctx;
 static struct des_ctx *des_ctx;
 
@@ -113,7 +129,8 @@
 		if (salt[1] == '5' || salt[1] == '6')
 			return sha_crypt((char*)key, (char*)salt);
 #endif
-	}
+	} else if (salt[0] == '$' && salt[1] == '2' && salt[2] == 'a' && salt[3] == '$')
+		return bf_crypt(key, salt);
 
 	if (!des_cctx)
 		des_cctx = const_des_init();
