SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from Fedora 30 libxcrypt-4.4.4-2.fc30.i686.rpm

CRYPT

Section: File Formats (5)
Index
BSD mandoc
Openwall Project 

NAME

crypt - storage format for hashed passphrases and available hashing methods 

DESCRIPTION

The hashing methods implemented bycrypt(3)are designed only to process user passphrases for storage and authentication;they are not suitable for use as general-purpose cryptographic hashes.

Passphrase hashing is not a replacement for strong passphrases.It is always possiblefor an attacker with access to the hashed passphrasesto guess and check possible cleartext passphrases.However, with a strong hashing method,guessing will be too slow for the attackerto discover a strong passphrase.

All of the hashing methods use a``salt''to perturb the hash function,so that the same passphrase may produce many possible hashes.Newer methods accept longer salt strings.The salt should be chosen at random for each user.Salt defeats a number of attacks:

  1. It is not possible to hash a passphrase onceand then test it against each account's stored hash;the hash calculation must be repeated for each account.
  2. It is not possible to tell whether two accounts use the same passphrasewithout successfully guessing one of the phrases.
  3. Tables of precalculated hashes of commonly used passphrasesmust have an entry for each possible salt,which makes them impractically large.

All of the hashing methods are also deliberately engineered to be slow;they use many iterations of an underlying cryptographic primitiveto increase the cost of each guess.The newer hashing methods allow the number of iterations to be adjusted,using the``CPU time cost''parameter tocrypt_gensalt3.This makes it possible to keep the hash slow as hardware improves. 

FORMAT OF HASHED PASSPHRASES

All of the hashing methods supported bycrypt(3)produce a hashed passphrase which consists of four components:prefix options salt andhash The prefix controls which hashing method is to be used, and is theappropriate string to pass tocrypt_gensalt3to select that method.The contents ofoptions salt andhashare up to the method.Depending on the method, theprefixandoptionscomponents may be empty.

TheFa settingargument tocrypt(3)must begin with the first three components of a valid hashed passphrase,but anything after that is ignored.This makes authentication simple:hash the input passphrase using the stored passphrase as the setting,and then compare the result to the stored passphrase.

Hashed passphrases are always entirely printable ASCII,and do not contain any whitespaceor the characters`:' `;' `*' `!' or`\' (These characters are used as delimiters and special markers in thepasswd(5)andshadow(5)files.)

The syntax of each component of a hashed passphraseis up to the hashing method.`$'characters usually delimit components,and the salt and hash are usually encoded as numerals in base 64.The details of this base-64 encoding vary among hashing methods.The common``base64''encoding specified by RFC 4648 is usuallynotused. 

AVAILABLE HASHING METHODS

This is a list ofallthe hashing methods supported bycrypt(3),in decreasing order of strength.Many of the older methodsare now considered too weak to use for new passphrases.The hashed passphrase format is expressedwith extended regular expressions (seeregex(7))and does not show the division into prefix, options, salt, and hash. 

yescrypt

yescrypt is a scalable passphrase hashing scheme designed by Solar Designer,which is based on Colin Percival's scrypt.Recommended for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$y$Ef
Maximum passphrase length
\$y\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{,86}\$[./A-Za-z0-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
CPU time cost parameter
up to 512

 

gost-yescrypt

gost-yescrypt uses the output from the yescrypt hashing method in place of ahmac message. Thus, the yescrypt crypto properties are superseeded by theGOST R 34.11-2012 (Streebog) hash function with a 256 bit digest.This hashing method is useful in applications that need modern passphrasehashing methods, but require to rely on the cryptographic properties of GOSTalgorithms.The GOST R 34.11-2012 (Streebog) hash function has been published by the IETFas RFC 6986.Recommended for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$gy$Ef
Maximum passphrase length
\$gy\$[./A-Za-z0-9]+\$[./A-Za-z0-9]{,86}\$[./A-Za-z0-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
CPU time cost parameter
up to 512

 

scrypt

scrypt is a password-based key derivation function created by Colin Percival,originally for the Tarsnap online backup service.The algorithm was specifically designed to make it costly to performlarge-scale custom hardware attacks by requiring large amounts of memory.In 2016, the scrypt algorithm was published by IETF as RFC 7914.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$7$Ef
Maximum passphrase length
\$7\$[./A-Za-z0-9]{11,97}\$[./A-Za-z0-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
CPU time cost parameter
up to 512

 

bcrypt

A hash based on the Blowfish block cipher,modified to have an extra-expensive key schedule.Originally developed by Niels Provos and David Mazieres for OpenBSDand also supported on recent versions of FreeBSD and NetBSD,on Solaris 10 and newer, and on several GNU/*/Linux distributions.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$2b$Ef
Maximum passphrase length
\$2[abxy]\$[0-9]{2}\$[./A-Za-z0-9]{53} characters
Hash size
184 bits
Effective key size
8 bits
Salt size
184 bits
CPU time cost parameter
128

The alternative prefix "$2y$" is equivalent to "$2b$".It exists for historical reasons only.The alternative prefixes "$2a$" and "$2x$"provide bug-compatibility with crypt_blowfish 1.0.4 and earlier,which incorrectly processed characters with the 8th bit set. 

sha512crypt

A hash based on SHA-2 with 512-bit output,originally developed by Ulrich Drepper for GNU libc.Supported on Linux but not common elsewhere.Acceptable for new hashes.The default CPU time cost parameter is 5000,which is too low for modern hardware.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$6$Ef
Maximum passphrase length
\$6\$(rounds=[1-9][0-9]+\$)?[./0-9A-Za-z]{1,16}\$[./0-9A-Za-z]{86} characters
Hash size
512 bits
Effective key size
8 bits
Salt size
512 bits
CPU time cost parameter
6 to 96

 

sha256crypt

A hash based on SHA-2 with 256-bit output,originally developed by Ulrich Drepper for GNU libc.Supported on Linux but not common elsewhere.Acceptable for new hashes.The default CPU time cost parameter is 5000,which is too low for modern hardware.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$5$Ef
Maximum passphrase length
\$5\$(rounds=[1-9][0-9]+\$)?[./0-9A-Za-z]{1,16}\$[./0-9A-Za-z]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
CPU time cost parameter
6 to 96

 

sha1crypt

A hash based on HMAC-SHA1.Originally developed by Simon Gerraty for NetBSD.Not as weak as the DES-based hashes below,but SHA1 is so cheap on modern hardwarethat it should not be used for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$sha1Ef
Maximum passphrase length
\$sha1\$[1-9][0-9]+\$[./0-9A-Za-z]{1,64}\$[./0-9A-Za-z]{8,64}[./0-9A-Za-z]{32} characters
Hash size
160 bits
Effective key size
8 bits
Salt size
160 bits
CPU time cost parameter
6 to 384

 

SunMD5

A hash based on the MD5 algorithm,with additional cleverness to make precomputation difficult,originally developed by Alec David Muffet for Solaris.Not adopted elsewhere, to our knowledge.Not as weak as the DES-based hashes below,but MD5 is so cheap on modern hardwarethat it should not be used for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$md5Ef
Maximum passphrase length
\$md5(,rounds=[1-9][0-9]+)?\$[./0-9A-Za-z]{8}\${1,2}[./0-9A-Za-z]{22} characters
Hash size
128 bits
Effective key size
8 bits
Salt size
128 bits
CPU time cost parameter
48

 

md5crypt

A hash based on the MD5 algorithm, originally developed byPoul-Henning Kamp for FreeBSD.Supported on most free Unixes and newer versions of Solaris.Not as weak as the DES-based hashes below,but MD5 is so cheap on modern hardwarethat it should not be used for new hashes.CPU time cost is not adjustable.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$1$Ef
Maximum passphrase length
\$1\$[^$]{1,8}\$[./0-9A-Za-z]{22} characters
Hash size
128 bits
Effective key size
8 bits
Salt size
128 bits
CPU time cost parameter
6 to 48

 

bsdicrypt (BSDI extended DES)

A weak extension of traditional DES,which eliminates the length limit,increases the salt size,and makes the time cost tunable.It originates with BSDIand is also available on at least NetBSD, OpenBSD, and FreeBSDdue to the use of David Burren's FreeSec library.It is better than bigcrypt and traditional DES,but still should not be used for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal_Ef
Maximum passphrase length
_[./0-9A-Za-z]{19} characters
Hash size
56 bits
Effective key size
7 bits
Salt size
64 bits
CPU time cost parameter
24

 

bigcrypt

A weak extension of traditional DES,available on some System V-derived Unixes.All it does is raise the length limit from 8 to 128 characters,and it does this in a crude way that allows attackers toguess chunks of a long passphrase in parallel.It should not be used for new hashes.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literalEf
Maximum passphrase length
[./0-9A-Za-z]{13,178} characters
Hash size
up to 896 bits
Effective key size
7 bits
Salt size
up to 1024 bits
CPU time cost parameter
12

 

descrypt (Traditional DES)

The original hashing method from Unix V7, based on the DES block cipher.Because DES is cheap on modern hardware,because there are only 4096 possible salts and 2**56 possible hashes,and because it truncates passphrases to 8 characters,it is feasible to discoveranypassphrase hashed with this method.It should only be used if you absolutely have to generate hashesthat will work on an old operating system that supports nothing else.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literalEf
Maximum passphrase length
[./0-9A-Za-z]{13} characters
Hash size
56 bits
Effective key size
7 bits
Salt size
64 bits
CPU time cost parameter
12

 

NT

The hashing method used for network authenticationin some versions of the SMB/CIFS protocol.Available, for cross-compatibility's sake, on FreeBSD.Based on MD4.Has no salt or tunable cost parameter.Like traditional DES, it is so weak thatanypassphrase hashed with this method is guessable.It should only be used if you absolutely have to generate hashesthat will work on an old operating system that supports nothing else.

Prefix
Bf "sh"Ef
Hashed passphrase format
Bf -literal$3$Ef
Maximum passphrase length
\$3\$\$[0-9a-f]{32} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
CPU time cost parameter
0

 

SEE ALSO

crypt(3),crypt_gensalt3,getpwent(3),passwd(5),shadow(5),pam(8)
Niels ProvosDavid MazieresA Future-Adaptable Password SchemeProceedings of the 1999 USENIX Annual Technical ConferenceJune 1999
Robert MorrisKen ThompsonPassword Security: A Case HistoryCommunications of the ACM22111979


 

Index

NAME
DESCRIPTION
FORMAT OF HASHED PASSPHRASES
AVAILABLE HASHING METHODS
yescrypt
gost-yescrypt
scrypt
bcrypt
sha512crypt
sha256crypt
sha1crypt
SunMD5
md5crypt
bsdicrypt (BSDI extended DES)
bigcrypt
descrypt (Traditional DES)
NT
SEE ALSO

This document was created byman2html,using the manual pages.