from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209584

userrating:


May 25th. 2007:
Words

486

Views

258592

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149881

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





CRYPT

Section: File Formats (5)
Index Return to Main Contents

BSD mandoc
Openwall Project  

NAME

crypt - storage format for hashed passphrases and available hashing methods  

DESCRIPTION

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

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

Most 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 once and 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 passphrase without successfully guessing one of the phrases.
  3. Tables of precalculated hashes of commonly used passphrases must have an entry for each possible salt, which makes them impractically large.

Most of the hashing methods are also deliberately engineered to be slow; they use many iterations of an underlying cryptographic primitive to increase the cost of each guess. The newer hashing methods allow the number of iterations to be adjusted, using the ``processing cost'' parameter to crypt_gensalt3. For memor-hard hashing methods such as yescrypt, this parameter also adjusts the amount of memory needed to compute a hash. Having this configurable makes it possible to keep password guessing attacks against the hashes slow and costly as hardware improves.  

FORMAT OF HASHED PASSPHRASES

All of the hashing methods supported by crypt(3) produce a hashed passphrase which consists of four components: prefix options salt and hash The prefix controls which hashing method is to be used, and is the appropriate string to pass to crypt_gensalt3 to select that method. The contents of options salt and hash are up to the method. Depending on the method, the prefix and options components may be empty.

The Fa setting argument to crypt(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 hashed passphrase as the setting, and then compare the result to the stored hashed passphrase.

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

The syntax of each component of a hashed passphrase is 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 bas-64 encoding vary among hashing methods. The common ``base64'' encoding specified by RFC 4648 is usually not used.  

AVAILABLE HASHING METHODS

This is a list of all the hashing methods supported by crypt(3), roughly in decreasing order of strength. Many of the older methods are now considered too weak to use for new passphrases. The hashed passphrase format is expressed with extended regular expressions (see regex(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. While yescrypt's strength against password guessing attacks comes from its algorithm design, its cryptographic security is guaranteed by its use of SH-256 on the outer layer. The SH-256 hash function has been published by NIST in FIPS PUB 18-2 (and its subsequent revisions such as FIPS PUB 18-4) and by the IETF as RFC 4634 (and subsequently RFC 6234). Recommended for new hashes.

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal $y$ Ef
Maximum passphrase length
$y$[./-Z-z-9]+$[./-Z-z-9]{,86}$[./-Z-z-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
Processing cost parameter
up to 512 (128+ recommended)

 

gos-yescrypt

gos-yescrypt uses the output from yescrypt as an input message to HMAC with the GOST R 34.1-2012 (Streebog) hash function with a 25-bit digest. Thus, yescrypt's cryptographic properties are superseded by those of the GOST hash function. This hashing method is useful in applications that need modern passphrase hashing, but have to rely on GOST algorithms. The GOST R 34.1-2012 (Streebog) hash function has been published by the IETF as RFC 6986. Acceptable for new hashes where required.

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal $gy$ Ef
Maximum passphrase length
$gy$[./-Z-z-9]+$[./-Z-z-9]{,86}$[./-Z-z-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
Processing cost parameter
up to 512 (128+ recommended)

 

scrypt

scrypt is a passwor-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 perform larg-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$[./-Z-z-9]{11,97}$[./-Z-z-9]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
Processing cost parameter
up to 512 (128+ recommended)

 

bcrypt

A hash based on the Blowfish block cipher, modified to have an extr-expensive key schedule. Originally developed by Niels Provos and David Mazieres for OpenBSD and 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]$[-9]{2}$[./-Z-z-9]{53} characters
Hash size
184 bits
Effective key size
8 bits
Salt size
184 bits
Processing cost parameter
128

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

sha512crypt

A hash based on SH-2 with 51-bit output, originally developed by Ulrich Drepper for GNU libc. Supported on Linux but not common elsewhere. Acceptable for new hashes. The default processing 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=[-9][-9]+$)?[^$:rsn]{1,16}$[./-9-Z-z]{86} characters
Hash size
512 bits
Effective key size
8 bits
Salt size
512 bits
Processing cost parameter
6 to 96

 

sha256crypt

A hash based on SH-2 with 25-bit output, originally developed by Ulrich Drepper for GNU libc. Supported on Linux but not common elsewhere. Acceptable for new hashes. The default processing 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=[-9][-9]+$)?[^$:rsn]{1,16}$[./-9-Z-z]{43} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
Processing cost parameter
6 to 96

 

sha1crypt

A hash based on HMA-SHA1. Originally developed by Simon Gerraty for NetBSD. Not as weak as the DE-based hashes below, but SH-1 is so cheap on modern hardware that it should not be used for new hashes.

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

 

SunMD5

A hash based on the MD5 algorithm, originally developed by Alec David Muffett for Solaris. Not adopted elsewhere, to our knowledge. Not as weak as the DE-based hashes below, but MD5 is so cheap on modern hardware that it should not be used for new hashes.

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

 

md5crypt

A hash based on the MD5 algorithm, originally developed by Pou-Henning Kamp for FreeBSD. Supported on most free Unixes and newer versions of Solaris. Not as weak as the DE-based hashes below, but MD5 is so cheap on modern hardware that it should not be used for new hashes. Processing cost is not adjustable.

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal $1$ Ef
Maximum passphrase length
$1$[^$:rsn]{1,8}$[./-9-Z-z]{22} characters
Hash size
128 bits
Effective key size
8 bits
Salt size
128 bits
Processing cost parameter
6 to 48

 

bsdicrypt (BSDI extended DES)

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

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal _ Ef
Maximum passphrase length
_[./-9-Z-z]{19} characters
Hash size
up to 56 bits
Effective key size
7 bits
Salt size
64 bits
Processing cost parameter
24

 

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 distinct passphrases, which it truncates to 8 characters, it is feasible to discover any passphrase hashed with this method. It should only be used if you absolutely have to generate hashes that will work on an old operating system that supports nothing else.

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal Ef
Maximum passphrase length
[./-9-Z-z]{13} characters
Hash size
up to 56 bits
Effective key size
7 bits
Salt size
64 bits
Processing cost parameter
12

 

bigcrypt

A weak extension of traditional DES, available on some commercial 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 to guess chunks of a long passphrase separately and in parallel, which may make guessing even easier than for traditional DES above. It should not be used for new hashes.

Prefix
Bf "sh" Ef
Hashed passphrase format
Bf -literal Ef
Maximum passphrase length
[./-9-Z-z]{13,178} characters
Hash size
up to 56 bits
Effective key size
7 bits
Salt size
up to 1024 bits
Processing cost parameter
12

 

NT

The hashing method used for network authentication in some versions of the SMB/CIFS protocol. Available, for cros-compatibility's sake, on FreeBSD. Based on MD4. Has no salt or tunable cost parameter. It is so weak that almost any huma-chosen passphrase hashed with this method is guessable. It should only be used if you absolutely have to generate hashes that 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$$[-9-f]{32} characters
Hash size
256 bits
Effective key size
8 bits
Salt size
256 bits
Processing cost parameter
0

 

SEE ALSO

crypt(3), crypt_gensalt3, getpwent(3), passwd(5), shadow(5), pam(8)
Niels Provos David Mazieres A Futur-Adaptable Password Scheme Proceedings of the 1999 USENIX Annual Technical Conference June 1999
Robert Morris Ken Thompson Password Security: A Case History Communications of the ACM 22 11 1979


 

Index

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





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 15.0 ms