Esempio n. 1
0
static char *make_des_salt(void)
{
    static char salt[3];
    generate_random_salt(salt, 2);
    salt[2] = '\0';
    return salt;
}
Esempio n. 2
0
static char *make_ext_salt(int rounds)
{
    static char salt[10];

    sprintf(salt, "_%s", int_to_base64(rounds));
    generate_random_salt(&salt[5], 4);
    salt[9] = '\0';
    return salt;
}
Esempio n. 3
0
char *
make_sha512_salt(int length)
{
    static char salt[21];
    if(length > 16) {
        printf("SHA512 salt length too long\n");
        exit(0);
    }
    salt[0] = '$';
    salt[1] = '6';
    salt[2] = '$';
    generate_random_salt(&salt[3], length);
    salt[length + 3] = '$';
    salt[length + 4] = '\0';
    return salt;
}
Esempio n. 4
0
static char *make_bf_salt(int rounds, int length)
{
    static char salt[31];
    char tbuf[3];
    if (length > 22)
    {
        printf("BlowFish salt length too long\n");
        exit(0);
    }
    sprintf(tbuf, "%02d", rounds);
    sprintf(salt, "$2a$%s$", tbuf);
    generate_random_salt(&salt[7], length);
    salt[length+7] = '$';
    salt[length+8] = '\0';
    return salt;
}
Esempio n. 5
0
char *
make_sha256_salt(int length)
{
	static char salt[21];
	if(length > 16)
	{
		fprintf(stderr, "SHA256 salt length too long\n");
		exit(1);
	}
	salt[0] = '$';
	salt[1] = '5';
	salt[2] = '$';
	generate_random_salt(&salt[3], length);
	salt[length + 3] = '$';
	salt[length + 4] = '\0';
	return salt;
}