{
    "mode": "man",
    "parameter": "crypt",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/crypt/5/json",
    "generated": "2026-09-17T08:07:18Z",
    "sections": {
        "NAME": {
            "content": "crypt — storage format for hashed passphrases and available hashing methods\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The hashing methods implemented by crypt(3) are designed only to process user passphrases for\nstorage  and  authentication;  they are not suitable for use as general-purpose cryptographic\nhashes.\n\nPassphrase hashing is not a replacement for strong passphrases.  It is always possible for an\nattacker with access to  the  hashed  passphrases  to  guess  and  check  possible  cleartext\npassphrases.   However,  with  a strong hashing method, guessing will be too slow for the at‐\ntacker to discover a strong passphrase.\n\nAll of the hashing methods use a “salt” to perturb  the  hash  function,  so  that  the  same\npassphrase  may produce many possible hashes.  Newer methods accept longer salt strings.  The\nsalt should be chosen at random for each user.  Salt defeats a number of attacks:\n\n1.   It is not possible to hash a passphrase once and then test  it  against  each  account's\nstored hash; the hash calculation must be repeated for each account.\n\n2.   It is not possible to tell whether two accounts use the same passphrase without success‐\nfully guessing one of the phrases.\n\n3.   Tables  of precalculated hashes of commonly used passphrases must have an entry for each\npossible salt, which makes them impractically large.\n\nAll of the hashing methods are also deliberately engineered to be slow; they use many  itera‐\ntions of an underlying cryptographic primitive to increase the cost of each guess.  The newer\nhashing  methods allow the number of iterations to be adjusted, using the “CPU time cost” pa‐\nrameter to cryptgensalt(3).  This makes it possible to keep the hash slow  as  hardware  im‐\nproves.\n",
            "subsections": []
        },
        "FORMAT OF HASHED PASSPHRASES": {
            "content": "All  of  the hashing methods supported by crypt(3) produce a hashed passphrase which consists\nof four components: prefix, options, salt, and  hash.   The  prefix  controls  which  hashing\nmethod  is  to  be  used, and is the appropriate string to pass to cryptgensalt(3) to select\nthat method.  The contents of options, salt, and hash are up to the method.  Depending on the\nmethod, the prefix and options components may be empty.\n\nThe setting argument to crypt(3) must begin with the first three components of a valid hashed\npassphrase, but anything after that is ignored.  This makes authentication simple:  hash  the\ninput  passphrase  using the stored passphrase as the setting, and then compare the result to\nthe stored passphrase.\n\nHashed passphrases are always entirely printable ASCII, and do not contain any whitespace  or\nthe characters ‘:’, ‘;’, ‘*’, ‘!’, or ‘\\’.  (These characters are used as delimiters and spe‐\ncial markers in the passwd(5) and shadow(5) files.)\n\nThe syntax of each component of a hashed passphrase is up to the hashing method.  ‘$’ charac‐\nters  usually  delimit  components,  and the salt and hash are usually encoded as numerals in\nbase 64.  The details of this base-64  encoding  vary  among  hashing  methods.   The  common\n“base64” encoding specified by RFC 4648 is usually not used.\n",
            "subsections": []
        },
        "AVAILABLE HASHING METHODS": {
            "content": "This  is  a  list  of  all  the hashing methods supported by crypt(3), in decreasing order of\nstrength.  Many of the older methods are now considered too weak to use for new  passphrases.\nThe  hashed  passphrase  format is expressed with extended regular expressions (see regex(7))\nand does not show the division into prefix, options, salt, and hash.\n",
            "subsections": [
                {
                    "name": "yescrypt",
                    "content": "yescrypt is a scalable passphrase hashing scheme designed by Solar Designer, which  is  based\non Colin Percival's scrypt.  Recommended for new hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$y$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$y\\$[./A-Za-z0-9]+\\$[./A-Za-z0-9]{,86}\\$[./A-Za-z0-9]{43}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "256 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "up to 512 (128+ recommended) bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1 to 11 (logarithmic)\n"
                },
                {
                    "name": "gost-yescrypt",
                    "content": "gost-yescrypt  uses  the  output from the yescrypt hashing method in place of a hmac message.\nThus, the yescrypt crypto properties are superseded by the GOST R 34.11-2012 (Streebog)  hash\nfunction with a 256 bit digest.  This hashing method is useful in applications that need mod‐\nern  passphrase  hashing methods, but require to rely on the cryptographic properties of GOST\nalgorithms.  The GOST R 34.11-2012 (Streebog) hash function has been published by the IETF as\nRFC 6986.  Recommended for new hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$gy$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$gy\\$[./A-Za-z0-9]+\\$[./A-Za-z0-9]{,86}\\$[./A-Za-z0-9]{43}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "256 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "up to 512 (128+ recommended) bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1 to 11 (logarithmic)\n"
                },
                {
                    "name": "scrypt",
                    "content": "scrypt is a password-based key derivation function created by Colin Percival, originally  for\nthe Tarsnap online backup service.  The algorithm was specifically designed to make it costly\nto  perform  large-scale  custom  hardware  attacks by requiring large amounts of memory.  In\n2016, the scrypt algorithm was published by IETF as RFC 7914.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$7$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$7\\$[./A-Za-z0-9]{11,97}\\$[./A-Za-z0-9]{43}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "256 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "up to 512 (128+ recommended) bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "6 to 11 (logarithmic)\n"
                },
                {
                    "name": "bcrypt",
                    "content": "A hash based on the Blowfish block cipher, modified to have an extra-expensive key  schedule.\nOriginally developed by Niels Provos and David Mazieres for OpenBSD and also supported on re‐\ncent versions of FreeBSD and NetBSD, on Solaris 10 and newer, and on several GNU/*/Linux dis‐\ntributions.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$2b$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$2[abxy]\\$[0-9]{2}\\$[./A-Za-z0-9]{53}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "72 characters\n"
                },
                {
                    "name": "Hash size",
                    "content": "184 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "128 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "4 to 31 (logarithmic)\n\nThe  alternative  prefix  \"$2y$\"  is  equivalent to \"$2b$\".  It exists for historical reasons\nonly.  The alternative prefixes \"$2a$\" and \"$2x$\" provide bug-compatibility with  cryptblow‐\nfish 1.0.4 and earlier, which incorrectly processed characters with the 8th bit set.\n"
                },
                {
                    "name": "sha512crypt",
                    "content": "A  hash  based  on  SHA-2 with 512-bit output, originally developed by Ulrich Drepper for GNU\nlibc.  Supported on Linux but not common elsewhere.  Acceptable for new hashes.  The  default\nCPU time cost parameter is 5000, which is too low for modern hardware.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$6$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$6\\$(rounds=[1-9][0-9]+\\$)?[^$:\\n]{1,16}\\$[./0-9A-Za-z]{86}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "512 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "6 to 96 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1000 to 999,999,999\n"
                },
                {
                    "name": "sha256crypt",
                    "content": "A  hash  based  on  SHA-2 with 256-bit output, originally developed by Ulrich Drepper for GNU\nlibc.  Supported on Linux but not common elsewhere.  Acceptable for new hashes.  The  default\nCPU time cost parameter is 5000, which is too low for modern hardware.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$5$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$5\\$(rounds=[1-9][0-9]+\\$)?[^$:\\n]{1,16}\\$[./0-9A-Za-z]{43}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "256 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "6 to 96 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1000 to 999,999,999\n"
                },
                {
                    "name": "sha1crypt",
                    "content": "A hash based on HMAC-SHA1.  Originally developed by Simon Gerraty for NetBSD.  Not as weak as\nthe  DES-based  hashes  below,  but SHA1 is so cheap on modern hardware that it should not be\nused for new hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$sha1\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$sha1\\$[1-9][0-9]+\\$[./0-9A-Za-z]{1,64}\\$[./0-9A-Za-z]{8,64}[./0-9A-Za-z]{32}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "160 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "6 to 384 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "4 to 4,294,967,295\n"
                },
                {
                    "name": "SunMD5",
                    "content": "A hash based on the MD5 algorithm, with additional cleverness to make  precomputation  diffi‐\ncult,  originally  developed by Alec David Muffet for Solaris.  Not adopted elsewhere, to our\nknowledge.  Not as weak as the DES-based hashes below, but MD5 is so cheap on modern hardware\nthat it should not be used for new hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$md5\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$md5(,rounds=[1-9][0-9]+)?\\$[./0-9A-Za-z]{8}\\${1,2}[./0-9A-Za-z]{22}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "128 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "48 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "4096 to 4,294,963,199\n"
                },
                {
                    "name": "md5crypt",
                    "content": "A hash based on the MD5 algorithm, originally developed by  Poul-Henning  Kamp  for  FreeBSD.\nSupported  on  most  free Unixes and newer versions of Solaris.  Not as weak as the DES-based\nhashes below, but MD5 is so cheap on modern hardware that it  should  not  be  used  for  new\nhashes.  CPU time cost is not adjustable.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$1$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$1\\$[^$:\\n]{1,8}\\$[./0-9A-Za-z]{22}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "128 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "6 to 48 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1000\n"
                },
                {
                    "name": "bsdicrypt (BSDI extended DES)",
                    "content": "A  weak  extension  of traditional DES, which eliminates the length limit, increases the salt\nsize, and makes the time cost tunable.  It originates with BSDI and is also available  on  at\nleast  NetBSD,  OpenBSD, and FreeBSD due to the use of David Burren's FreeSec library.  It is\nbetter than bigcrypt and traditional DES, but still should not be used for new hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "[./0-9A-Za-z]{19}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited (ignores 8th bit)\n"
                },
                {
                    "name": "Hash size",
                    "content": "64 bits\n"
                },
                {
                    "name": "Effective key size",
                    "content": "56 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "24 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1 to 16,777,215 (must be odd)\n"
                },
                {
                    "name": "bigcrypt",
                    "content": "A weak extension of traditional DES, available on some System V-derived Unixes.  All it  does\nis  raise the length limit from 8 to 128 characters, and it does this in a crude way that al‐\nlows attackers to guess chunks of a long passphrase in parallel.  It should not be  used  for\nnew hashes.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"\" (empty string)\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "[./0-9A-Za-z]{13,178}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "128 characters (ignores 8th bit)\n"
                },
                {
                    "name": "Hash size",
                    "content": "up to 1024 bits\n"
                },
                {
                    "name": "Effective key size",
                    "content": "up to 896 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "12 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "25\n"
                },
                {
                    "name": "descrypt (Traditional DES)",
                    "content": "The  original  hashing  method  from  Unix V7, based on the DES block cipher.  Because DES is\ncheap on modern hardware, because there are only  4096  possible  salts  and  256  possible\nhashes,  and because it truncates passphrases to 8 characters, it is feasible to discover any\npassphrase hashed with this method.  It should only be used if you absolutely have to  gener‐\nate hashes that will work on an old operating system that supports nothing else.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"\" (empty string)\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "[./0-9A-Za-z]{13}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "8 characters (ignores 8th bit)\n"
                },
                {
                    "name": "Hash size",
                    "content": "64 bits\n"
                },
                {
                    "name": "Effective key size",
                    "content": "56 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "12 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "25\n\nNT\nThe hashing method used for network authentication in some versions of the SMB/CIFS protocol.\nAvailable, for cross-compatibility's sake, on FreeBSD.  Based on MD4.  Has no salt or tunable\ncost  parameter.   Like  traditional  DES, it is so weak that any passphrase hashed with this\nmethod is guessable.  It should only be used if you absolutely have to generate  hashes  that\nwill work on an old operating system that supports nothing else.\n"
                },
                {
                    "name": "Prefix",
                    "content": "\"$3$\"\n"
                },
                {
                    "name": "Hashed passphrase format",
                    "content": "\\$3\\$\\$[0-9a-f]{32}\n"
                },
                {
                    "name": "Maximum passphrase length",
                    "content": "unlimited\n"
                },
                {
                    "name": "Hash size",
                    "content": "256 bits\n"
                },
                {
                    "name": "Salt size",
                    "content": "0 bits\n"
                },
                {
                    "name": "CPU time cost parameter",
                    "content": "1\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "crypt(3), cryptgensalt(3), getpwent(3), passwd(5), shadow(5), pam(8)\n\nNiels  Provos  and  David  Mazieres, “A Future-Adaptable Password Scheme”, Proceedings of the\n1999 USENIX Annual Technical Conference,  https://www.usenix.org/events/usenix99/provos.html,\nJune 1999.\n\nRobert  Morris  and  Ken Thompson, “Password Security: A Case History”, Communications of the\nACM, 11, 22, http://wolfram.schneider.org/bsd/7thEdManVol2/password/password.pdf, 1979.\n\nOpenwall Project                          October 11, 2017                                  CRYPT(5)",
            "subsections": []
        }
    },
    "summary": "crypt — storage format for hashed passphrases and available hashing methods",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "cryptgensalt",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cryptgensalt/3/json"
        },
        {
            "name": "getpwent",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/getpwent/3/json"
        },
        {
            "name": "passwd",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/5/json"
        },
        {
            "name": "shadow",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/shadow/5/json"
        },
        {
            "name": "pam",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/pam/8/json"
        }
    ]
}