-+#include <pwd.h>
-+#include "blf.h"
-+
-+/* This implementation is adaptable to current computing power.
-+ * You can have up to 2^31 rounds which should be enough for some
-+ * time to come.
-+ */
-+
-+#define BCRYPT_VERSION '2'
-+#define BCRYPT_MAXSALT 16 /* Precomputation is just so nice */
-+#define BCRYPT_BLOCKS 6 /* Ciphertext blocks */
-+#define BCRYPT_MINROUNDS 16 /* we have log2(rounds) in salt */
-+
-+char *bcrypt_gensalt __P((u_int8_t));
-+
-+static void encode_salt __P((char *, u_int8_t *, u_int16_t, u_int8_t));
-+static void encode_base64 __P((u_int8_t *, u_int8_t *, u_int16_t));
-+static void decode_base64 __P((u_int8_t *, u_int16_t, u_int8_t *));
-+
-+static char encrypted[128];
-+static char gsalt[BCRYPT_MAXSALT * 4 / 3 + 1];
-+static char error[] = ":";
-+
-+const static u_int8_t Base64Code[] =
-+"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-+
-+const static u_int8_t index_64[128] =
-+{
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
-+ 255, 255, 255, 255, 255, 255, 0, 1, 54, 55,
-+ 56, 57, 58, 59, 60, 61, 62, 63, 255, 255,
-+ 255, 255, 255, 255, 255, 2, 3, 4, 5, 6,
-+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
-+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
-+ 255, 255, 255, 255, 255, 255, 28, 29, 30,
-+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
-+ 51, 52, 53, 255, 255, 255, 255, 255
-+};
-+#define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)])
-+
-+#ifdef __STDC__
-+static void
-+decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data)
-+#else
-+static void
-+decode_base64(buffer, len, data)
-+ u_int8_t *buffer;
-+ u_int16_t len;
-+ u_int8_t *data;
-+#endif
-+{
-+ u_int8_t *bp = buffer;
-+ u_int8_t *p = data;
-+ u_int8_t c1, c2, c3, c4;
-+ while (bp < buffer + len) {
-+ c1 = CHAR64(*p);
-+ c2 = CHAR64(*(p + 1));
-+
-+ /* Invalid data */
-+ if (c1 == 255 || c2 == 255)
-+ break;
-+
-+ *bp++ = (c1 << 2) | ((c2 & 0x30) >> 4);
-+ if (bp >= buffer + len)
-+ break;
-+
-+ c3 = CHAR64(*(p + 2));
-+ if (c3 == 255)
-+ break;
-+
-+ *bp++ = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2);
-+ if (bp >= buffer + len)
-+ break;
-+
-+ c4 = CHAR64(*(p + 3));
-+ if (c4 == 255)
-+ break;
-+ *bp++ = ((c3 & 0x03) << 6) | c4;