passwords:password_schemes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
passwords:password_schemes [2016/07/02 12:53] – peter | passwords:password_schemes [2019/12/01 22:03] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Passwords - Password Schemes ====== | ||
- | |||
- | Password scheme means the format in which the password is stored in password databases. | ||
- | |||
- | ===== What scheme to use? ===== | ||
- | |||
- | You should choose the strongest crypt scheme that's supported by your system. | ||
- | |||
- | * BLF-CRYPT: This is the Blowfish crypt (bcrypt) scheme. | ||
- | |||
- | * SHA512-CRYPT: | ||
- | |||
- | * SHA256-CRYPT: | ||
- | |||
- | * MD5-CRYPT: A weak but common scheme often used in / | ||
- | |||
- | Note that the above schemes are implemented by the libc's crypt() function. | ||
- | |||
- | Other password schemes that are not in libc. | ||
- | |||
- | * LANMAN: DES-based encryption. Used sometimes with NTLM mechanism. | ||
- | |||
- | * NTLM: MD4 sum of the password stored in hex. Used with NTLM mechanism. | ||
- | |||
- | * RPA: Used with RPA mechanism. | ||
- | |||
- | * CRAM-MD5: Used with CRAM-MD5 mechanism. | ||
- | |||
- | * DIGEST-MD5: Used with DIGEST-MD5 mechanism. | ||
- | |||
- | * SCRAM-SHA-1: | ||
- | |||
- | * CRYPT: Traditional DES-crypted password in /etc/passwd (e.g. " | ||
- | |||
- | * PLAIN: Password is in plaintext. | ||
- | |||
- | |||
- | ===== MD5 based schemes ===== | ||
- | |||
- | * PLAIN-MD5: MD5 sum of the password stored in hex. | ||
- | |||
- | * LDAP-MD5: MD5 sum of the password stored in base64. | ||
- | |||
- | * SMD5: Salted MD5 sum of the password stored in base64. | ||
- | |||
- | |||
- | ===== SHA based schemes (also see below for libc's SHA* support) ===== | ||
- | |||
- | * SHA: SHA1 sum of the password stored in base64. | ||
- | |||
- | * SSHA: Salted SHA1 sum of the password stored in base64. | ||
- | |||
- | * SHA256: SHA256 sum of the password stored in base64. (v1.1 and later). | ||
- | |||
- | * SSHA256: Salted SHA256 sum of the password stored in base64. (v1.2 and later). | ||
- | |||
- | * SHA512: SHA512 sum of the password stored in base64. (v2.0 and later). | ||
- | |||
- | * SSHA512: Salted SHA512 sum of the password stored in base64. (v2.0 and later). | ||
- | |||
- | |||
- | ===== Encoding ===== | ||
- | |||
- | The base64 vs. hex encoding that is mentioned above is simply the default encoding that is used. You can override it for any scheme by adding a " | ||
- | |||
- | * {SSHA.b64}986H5cS9JcDYQeJd6wKaITMho4M9CrXM contains the password encoded to base64 (just like {SSHA}) | ||
- | |||
- | * {SSHA.HEX}3f5ca6203f8cdaa44d9160575c1ee1d77abcf59ca5f852d1 contains the password encoded to hex | ||
- | |||
- | This can be especially useful with plaintext passwords to encode characters that would otherwise be illegal. | ||
- | |||
- | |||
- | ===== Salting ===== | ||
- | |||
- | For the SHA512-CRYPT, | ||
- | |||
- | For most of the other salted password schemes (SMD5, SSHA*) the salt is stored after the password hash and its length can vary. When hashing the password, append the salt after the plaintext password, e.g.: SSHA256(pass, | ||
- | |||
- | For example with SSHA256 you know that the hash itself is 32 bytes (256 bits/8 bits per byte). | ||
- | |||
- | < | ||
- | {SSHA256}SoR/ | ||
- | </ | ||
- | |||
- | After base64 decoding it you'll see that its length is 36 bytes, so the first 32 bytes are the hash and the following 4 bytes are the salt: | ||
- | |||
- | * length: echo SoR/ | ||
- | |||
- | * hash: echo SoR/ | ||
- | |||
- | * salt: echo SoR/ | ||
- | |||
- | Other common hash sizes are: | ||
- | |||
- | * MD5: 16 bytes | ||
- | * SHA: 20 bytes | ||
- | * SHA256: 32 bytes | ||
- | * SHA512: 64 bytes | ||
- | |||
- | |||
passwords/password_schemes.1467464014.txt.gz · Last modified: 2020/07/15 09:30 (external edit)