{
    "mode": "man",
    "parameter": "crypt_preferred_method",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/crypt_preferred_method/3/json",
    "generated": "2026-06-15T16:12:20Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "cryptpreferredmethod — get the prefix of the preferred hash method\n",
            "subsections": []
        },
        "LIBRARY": {
            "content": "Crypt Library (libcrypt, -lcrypt)\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <crypt.h>",
                    "content": "const char*\ncryptpreferredmethod(void);\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "cryptpreferredmethod is a convenience function to get the prefix of the preferred hash\nmethod.  If a preferred method is available, it is the same as the one also used by the\ncryptgensalt functions, if their given prefix parameter is NULL.\n",
            "subsections": []
        },
        "RETURN VALUES": {
            "content": "The string returned equals the prefix of the preferred hash method.  If no preferred hash\nmethod is available it is NULL.  It is safe to pass the string returned by\ncryptpreferredmethod directly to cryptgensalt without prior string-sanitizing nor NULL-\npointer checks.\n",
            "subsections": []
        },
        "FEATURE TEST MACROS": {
            "content": "<crypt.h> will define the macro CRYPTPREFERREDMETHODAVAILABLE if cryptpreferredmethod is\navailable in the current version of libxcrypt.\n",
            "subsections": []
        },
        "PORTABILITY NOTES": {
            "content": "The function cryptpreferredmethod is not part of any standard.  It was added to libxcrypt in\nversion 4.4.0.\n",
            "subsections": []
        },
        "ATTRIBUTES": {
            "content": "For an explanation of the terms used in this section, see attributes(7).\n┌───────────────────────┬───────────────┬─────────┐\n│Interface              │ Attribute     │ Value   │\n├───────────────────────┼───────────────┼─────────┤\n│cryptpreferredmethod │ Thread safety │ MT-Safe │\n└───────────────────────┴───────────────┴─────────┘\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "cryptgensalt(3)\n\nlibxcrypt                      November 16, 2018                     libxcrypt",
            "subsections": []
        }
    },
    "summary": "cryptpreferredmethod — get the prefix of the preferred hash method",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "cryptgensalt",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cryptgensalt/3/json"
        }
    ]
}