# crypt_checksalt - validate a crypt setting string - man(3) - [phpMan]

[_CRYPT_CHECKSALT_(3)](https://www.chedong.com/phpMan.php/man/CRYPTCHECKSALT/3/markdown)                     Library Functions Manual                   [_CRYPT_CHECKSALT_(3)](https://www.chedong.com/phpMan.php/man/CRYPTCHECKSALT/3/markdown)

## NAME
       crypt_checksalt — validate a crypt setting string

## LIBRARY
       Crypt Library (libcrypt, -lcrypt)

## SYNOPSIS
### #include <crypt.h>

       _int_
       **crypt_checksalt**(_const_ _char_ _*setting_);

## DESCRIPTION
       **crypt_checksalt  **checks  the  _setting_  string  against  the  system configuration and reports
       whether the hashing method and parameters it specifies are acceptable.  It is intended to  be
       used  by  programs  such as [_login_(1)](https://www.chedong.com/phpMan.php/man/login/1/markdown) to determine whether the user's passphrase should be re-
       hashed using the currently preferred hashing method.

## RETURN VALUES
       The return value is 0 if there is nothing wrong with this setting.  Otherwise, it is  one  of
       the following constants:

       CRYPT_SALT_OK
             _setting_ is a fully correct setting string.  This constant is guaranteed to equal 0.

       CRYPT_SALT_INVALID
             _setting_ is not a valid setting string; either it specifies a hashing method that is not
             known to this version of libxcrypt, or it specifies invalid parameters for the method.

       CRYPT_SALT_METHOD_DISABLED (Not implemented, yet)
             _setting_  specifies  a hashing method that is no longer allowed to be used at all; **crypt**
             will fail if passed this _setting_.  Manual intervention will be required  to  reactivate
             the user's account.

       CRYPT_SALT_METHOD_LEGACY
             _setting_  specifies  a hashing method that is no longer considered strong enough for use
             with new passphrases.  **crypt **will still authenticate a passphrase against this setting,
             but if authentication succeeds, the passphrase should be re-hashed using the  currently
             preferred method.

       CRYPT_SALT_TOO_CHEAP (Not implemented, yet)
             _setting_  specifies  cost  parameters  that  are  considered  too cheap for use with new
             passphrases.  **crypt **will still authenticate a passphrase against this setting,  but  if
             authentication  succeeds,  the  passphrase should be re-hashed using the currently pre‐
             ferred method.

## FEATURE TEST MACROS
       <_crypt.h_> will define the macro CRYPT_CHECKSALT_AVAILABLE if **crypt_checksalt **is available  in
       the current version of libxcrypt.

## BUGS
       Since  full configurability is not yet implemented, the current implementation will only ever
       return **CRYPT_SALT_OK (0) **or **CRYPT_SALT_INVALID **when invoked.

## PORTABILITY NOTES
       The function **crypt_checksalt **is not part of any standard.  It was added to libxcrypt in  ver‐
       sion 4.3.0.

## ATTRIBUTES
       For an explanation of the terms used in this section, see [_attributes_(7)](https://www.chedong.com/phpMan.php/man/attributes/7/markdown).
       ┌─────────────────┬───────────────┬─────────┐
       │ **Interface       **│ **Attribute     **│ **Value   **│
       ├─────────────────┼───────────────┼─────────┤
       │ **crypt_checksalt **│ Thread safety │ MT-Safe │
       └─────────────────┴───────────────┴─────────┘


## SEE ALSO
       [_crypt_(3)](https://www.chedong.com/phpMan.php/man/crypt/3/markdown), [_crypt_gensalt_(3)](https://www.chedong.com/phpMan.php/man/cryptgensalt/3/markdown), [_crypt_(5)](https://www.chedong.com/phpMan.php/man/crypt/5/markdown)

libxcrypt                                 November 8, 2018                        [_CRYPT_CHECKSALT_(3)](https://www.chedong.com/phpMan.php/man/CRYPTCHECKSALT/3/markdown)
