refactor get_salt function
refactor get_salt function to make it easier to read.
This commit is contained in:
parent
3732cf72d6
commit
3c1e5fcf16
@ -394,18 +394,19 @@ static void close_files (void)
|
||||
|
||||
static const char *get_salt(void)
|
||||
{
|
||||
if ( !eflg
|
||||
&& ( (NULL == crypt_method)
|
||||
|| (0 != strcmp (crypt_method, "NONE")))) {
|
||||
void *arg = NULL;
|
||||
|
||||
if (eflg || ((NULL != crypt_method) && (0 == strcmp (crypt_method, "NONE")))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (md5flg) {
|
||||
crypt_method = "MD5";
|
||||
}
|
||||
#if defined(USE_SHA_CRYPT) || defined(USE_BCRYPT) || defined(USE_YESCRYPT)
|
||||
if (sflg) {
|
||||
#if defined(USE_SHA_CRYPT)
|
||||
if ( (0 == strcmp (crypt_method, "SHA256"))
|
||||
if ((0 == strcmp (crypt_method, "SHA256"))
|
||||
|| (0 == strcmp (crypt_method, "SHA512"))) {
|
||||
arg = &sha_rounds;
|
||||
}
|
||||
@ -423,9 +424,6 @@ static const char *get_salt(void)
|
||||
}
|
||||
#endif
|
||||
return crypt_make_salt (crypt_method, arg);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
|
Loading…
Reference in New Issue
Block a user