# phpman > man > crypt_preferred_method(3)

CRYPT_PREFERRED_METHO... BSD Library Functions Manual CRYPT_PREFERRED_METHO...

## NAME
     **crypt**___**preferred**___**method** — get the prefix of the preferred hash method

## LIBRARY
     Crypt Library (libcrypt, -lcrypt)

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

     _const_ _char*_
     **crypt**___**preferred**___**method**(_void_);

## DESCRIPTION
     **crypt**___**preferred**___**method** is a convenience function to get the prefix of the preferred hash
     method.  If a preferred method is available, it is the same as the one also used by the
     **crypt**___**gensalt** **functions**, if their given _prefix_ parameter is NULL.

## RETURN VALUES
     The string returned equals the prefix of the preferred hash method.  If no preferred hash
     method is available it is NULL.  It _is_ safe to pass the string returned by
     **crypt**___**preferred**___**method** directly to **crypt**___**gensalt** without prior string-sanitizing nor NULL-
     pointer checks.

## FEATURE TEST MACROS
     <_crypt.h_> will define the macro CRYPT_PREFERRED_METHOD_AVAILABLE if **crypt**___**preferred**___**method** is
     available in the current version of libxcrypt.

## PORTABILITY NOTES
     The function **crypt**___**preferred**___**method** is not part of any standard.  It was added to libxcrypt in
     version 4.4.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**___**preferred**___**method** │ Thread safety │ MT-Safe │
     └───────────────────────┴───────────────┴─────────┘

## SEE ALSO
     [crypt_gensalt(3)](https://www.chedong.com/phpMan.php/man/cryptgensalt/3/markdown)

libxcrypt                      November 16, 2018                     libxcrypt
