s->h[7] = 0x5be0cd19;
}
-static void sha256_sum(struct sha256 *s, uint8_t md[20])
+static void sha256_sum(struct sha256 *s, uint8_t *md)
{
int i;
memcpy(s->buf, p, len);
}
-static unsigned char b64[] =
+static const unsigned char b64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static char *to64(char *s, unsigned int u, int n)
#define SALT_MAX 16
#define ROUNDS_DEFAULT 5000
#define ROUNDS_MIN 1000
-#define ROUNDS_MAX 50000
+#define ROUNDS_MAX 9999999
/* hash n bytes of the repeated md message digest */
static void hashmd(struct sha256 *s, unsigned int n, const void *md)
if (u < ROUNDS_MIN)
r = ROUNDS_MIN;
else if (u > ROUNDS_MAX)
- r = ROUNDS_MAX;
+ return 0;
else
r = u;
/* needed when rounds is zero prefixed or out of bounds */