Lines Matching defs:salt
7 * in the salt and rounds= setting must contain a valid iteration count,
193 const char *salt;
201 /* setting: $5$rounds=n$salt$ (rounds=n$ and closing $ are optional) */
204 salt = setting + 3;
207 if (strncmp(salt, "rounds=", sizeof "rounds=" - 1) == 0) {
218 * rounds as part of the salt or parse them with
223 salt += sizeof "rounds=" - 1;
224 if (!isdigit(*salt))
226 u = strtoul(salt, &end, 10);
229 salt = end+1;
240 for (i = 0; i < SALT_MAX && salt[i] && salt[i] != '$'; i++)
242 if (salt[i] == '\n' || salt[i] == ':')
246 /* B = sha(key salt key) */
249 sha256_update(&ctx, salt, slen);
253 /* A = sha(key salt repeat-B alternate-B-key) */
256 sha256_update(&ctx, salt, slen);
271 /* DS = sha(repeat-salt) */
274 sha256_update(&ctx, salt, slen);
295 /* output is $5$rounds=n$salt$hash */
297 p += sprintf(p, "$5$%s%.*s$", rounds, slen, salt);