PBKDF2

In cryptography, PBKDF1 and PBKDF2 (Password-Based Key Derivation Function 1 and 2) are key derivation functions with a sliding computational cost, used to reduce vulnerability to brute-force attacks.[1]

PBKDF2 is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, specifically PKCS #5 v2.0, also published as Internet Engineering Task Force's RFC 2898. It supersedes PBKDF1, which could only produce derived keys up to 160 bits long.[2] RFC 8018 (PKCS #5 v2.1), published in 2017, recommends PBKDF2 for password hashing.[3]

Purpose and operation

PBKDF2 applies a pseudorandom function, such as hash-based message authentication code (HMAC), to the input password or passphrase along with a salt value and repeats the process many times to produce a derived key, which can then be used as a cryptographic key in subsequent operations. The added computational work makes password cracking much more difficult, and is known as key stretching.

When the standard was written in the year 2000 the recommended minimum number of iterations was 1,000, but the parameter is intended to be increased over time as CPU speeds increase. A Kerberos standard in 2005 recommended 4,096 iterations;[1] Apple reportedly used 2,000 for iOS 3, and 10,000 for iOS 4;[4] while LastPass in 2011 used 5,000 iterations for JavaScript clients and 100,000 iterations for server-side hashing.[5] In 2023, OWASP recommended to use 600,000 iterations for PBKDF2-HMAC-SHA256 and 210,000 for PBKDF2-HMAC-SHA512.[6]

Algorithmic representation of the iterative process of the Password-Based Key Derivation Function 2.

Having a salt added to the password reduces the ability to use precomputed hashes (rainbow tables) for attacks, and means that multiple passwords have to be tested individually, not all at once. The public key cryptography standard recommends a salt length of at least 64 bits.[7] The US National Institute of Standards and Technology recommends a salt length of at least 128 bits.[8]

Key derivation process

The PBKDF2 key derivation function has five input parameters:[9]

DK = PBKDF2(PRF, Password, Salt, c, dkLen)

where:

  • PRF is a pseudorandom function of two parameters with output length hLen (e.g., a keyed HMAC)
  • Password is the master password from which a derived key is generated
  • Salt is a sequence of bits, known as a cryptographic salt
  • c is the number of iterations desired
  • dkLen is the desired bit-length of the derived key
  • DK is the generated derived key

Each hLen-bit block Ti of derived key DK, is computed as follows (with + marking string concatenation):

DK = T1 + T2 + ⋯ + Tdklen/hlen
Ti = F(Password, Salt, c, i)

The function F is the xor (^) of c iterations of chained PRFs. The first iteration of PRF uses Password as the PRF key and Salt concatenated with i encoded as a big-endian 32-bit integer as the input. (Note that i is a 1-based index.) Subsequent iterations of PRF use Password as the PRF key and the output of the previous PRF computation as the input:

F(Password, Salt, c, i) = U1 ^ U2 ^ ⋯ ^ Uc

where:

U1 = PRF(Password, Salt + INT_32_BE(i))
U2 = PRF(Password, U1)
Uc = PRF(Password, Uc−1)

For example, WPA2 uses:

DK = PBKDF2(HMAC−SHA1, passphrase, ssid, 4096, 256)

PBKDF1 had a simpler process: the initial U (called T in this version) is created by PRF(Password + Salt), and the following ones are simply PRF(Uprevious). The key is extracted as the first dkLen bits of the final hash, which is why there is a size limit.[9]

HMAC collisions

PBKDF2 has an interesting property when using HMAC as its pseudo-random function. It is possible to trivially construct any number of different password pairs with collisions within each pair.[10] If a supplied password is longer than the block size of the underlying HMAC hash function, the password is first pre-hashed into a digest, and that digest is instead used as the password. For example, the following password is too long:

  • Password: plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd

therefore, when using HMAC-SHA1, it is pre-hashed using SHA-1 into:

  • SHA1 (hex): 65426b585154667542717027635463617226672a

Which can be represented in ASCII as:

  • SHA1 (ASCII): eBkXQTfuBqp'cTcar&g*

This means regardless of the salt or iterations, PBKDF2-HMAC-SHA1 will generate the same key bytes for the passwords:

  • "plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd"
  • "eBkXQTfuBqp'cTcar&g*"

For example, using:

  • PRF: HMAC-SHA1
  • Salt: A009C1A485912C6AE630D3E744240B04
  • Iterations: 1,000
  • Derived key length: 16 bytes

The following two function calls:

PBKDF2-HMAC-SHA1("plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd", ...)
PBKDF2-HMAC-SHA1("eBkXQTfuBqp'cTcar&g*", ...)

will generate the same derived key bytes (17EB4014C8C461C300E9B61518B9A18B). These derived key collisions do not represent a security vulnerability – as one still must know the original password in order to generate the hash of the password.[11]

Alternatives to PBKDF2

One weakness of PBKDF2 is that while its number of iterations can be adjusted to make it take an arbitrarily large amount of computing time, it can be implemented with a small circuit and very little RAM, which makes brute-force attacks using application-specific integrated circuits or graphics processing units relatively cheap.[12] The bcrypt password hashing function requires a larger amount of RAM (but still not tunable separately, i.e. fixed for a given amount of CPU time) and is significantly stronger against such attacks,[13] while the more modern scrypt key derivation function can use arbitrarily large amounts of memory and is therefore more resistant to ASIC and GPU attacks.[12]

In 2013, the Password Hashing Competition (PHC) was held to develop a more resistant approach. On 20 July 2015 Argon2 was selected as the final PHC winner, with special recognition given to four other password hashing schemes: Catena, Lyra2, yescrypt and Makwa.[14] Another alternative is Balloon hashing, which is recommended in NIST password guidelines.[15]

To limit a brute-force attack, it is possible to make each password attempt require an online interaction, without harming the confidentiality of the password. This can be done using an oblivious pseudorandom function to perform password-hardening.[16] This can be done as alternative to, or as an additional step in, a PBKDF.

See also

References

  1. ^ a b Raeburn, Kenneth (2005). "Advanced Encryption Standard (AES) Encryption for Kerberos 5". tools.ietf.org. doi:10.17487/RFC3962. RFC 3962. Retrieved October 23, 2015.
  2. ^ Kaliski, Burt (2000). "PKCS #5: Password-Based Cryptography Specification, Version 2.0". tools.ietf.org. doi:10.17487/RFC2898. RFC 2898. Retrieved October 23, 2015.
  3. ^ Moriarty, Kathleen; et al. (2017). Moriarty, K (ed.). "PKCS #5: Password-Based Cryptography Specification, Version 2.1". tools.ietf.org. doi:10.17487/RFC8018. RFC 8018.
  4. ^ "Smartphone Forensics: Cracking BlackBerry Backup Passwords". Advanced Password Cracking – Insight. ElcomSoft. September 30, 2010. Retrieved October 23, 2015.
  5. ^ "LastPass Security Notification". The LastPass Blog. May 5, 2011. Retrieved January 31, 2023.
  6. ^ "Password Storage Cheat Sheet". OWASP Cheat Sheet Series. August 15, 2021. Archived from the original on January 23, 2023. Retrieved January 23, 2023.
  7. ^ Moriarty, Kathleen; et al. (2017). Moriarty, K (ed.). "PKCS #5: Password-Based Cryptography Specification, Version 2.1: Section 4. Salt and Iteration Count". tools.ietf.org. doi:10.17487/RFC8018. RFC 8018. Retrieved January 24, 2018.
  8. ^ Sönmez Turan, Meltem; Barker, Elaine; Burr, William; Chen, Lily. "Recommendation for Password-Based Key Derivation Part 1: Storage Applications" (PDF). NIST. SP 800-132. Retrieved December 20, 2018.
  9. ^ a b Password-Based Cryptography Specification RFC 2898
  10. ^ Bynens, Mathias. "PBKDF2+HMAC hash collisions explained". mathiasbynens.be.
  11. ^ "Collision resistance - Why is HMAC-SHA1 still considered secure?". crypto.stackexchange.com.
  12. ^ a b Colin Percival. scrypt. As presented in "Stronger Key Derivation via Sequential Memory-Hard Functions". presented at BSDCan'09, May 2009.
  13. ^ "New 25 GPU Monster Devours Passwords In Seconds". The Security Ledger. December 4, 2012. Retrieved September 7, 2013.
  14. ^ "Password Hashing Competition"
  15. ^ "Digital Identity Guidelines Authentication and Lifecycle Management Section 5.1.1.2" (PDF). NIST. SP 800-63B. Retrieved June 18, 2021.
  16. ^ Ford, W.; Kaliski, B. S. (2000). "Server-assisted generation of a strong secret from a password". Proceedings IEEE 9th International Workshops on Enabling Technologies: Infrastructure for Collaborative Enterprises (WET ICE 2000). pp. 176–180. doi:10.1109/ENABL.2000.883724. ISBN 0-7695-0798-0. S2CID 1977743.

Read other articles:

American politician (1776–1857) Langdon ChevesPortrait of Cheves as Speaker of the U.S. House c. 1815President of the Second Bank of the United StatesIn officeMarch 6, 1819 – January 6, 1823PresidentJames MonroePreceded byJames Fisher (acting)Succeeded byNicholas Biddle8th Speaker of the United States House of RepresentativesIn officeJanuary 19, 1814 – March 3, 1815Preceded byHenry ClaySucceeded byHenry ClayMember of the U.S. House of Representativesfrom South…

Kirkop Ħal KirkopDewan lokal BenderaLambang kebesaranLokasi di MaltaNegara MaltaLuas • Total1,1 km2 (4 sq mi)Populasi (2014) • Total2.191 • Kepadatan200/km2 (520/sq mi)Kode ISO 3166-2MT-23 Kirkop adalah salah satu dewan lokal di Malta. Menurut sensus 2014, Kirkop memiliki luas 1,1 kilometer persegi dan populasi 2.191 jiwa. Kode ISO 3166-2 daerah ini adalah MT-23. Referensi City Population: Malta lbsDewan lokal di Malta dan GozoMa…

Muhammad Mustafa Al-A‘zamiA'zami saat meluncurkan 39 buku elektronik Mohammad Najeeb Qasmi Informasi pribadiLahir1930Mau, IndiaMeninggal20 Desember 2017RiyadhMakamMasjid Al-Rajhi, RiyadhAgamaIslamAlmamaterUniversitas Al-Azhar, Universitas CambridgePekerjaanMuhadditsPemimpin MuslimPenghargaanPenghargaan Internasional Raja Faisal pada tahun 1980 (Cabang Studi Islam) Muhammad Mustafa Al-A'zami (Arab: محمد مصطفى الأعظمي; 1930 – 20 Desember 2017) adalah seorang Ahli Hadis kont…

此條目需要擴充。 (2015年11月27日)请協助改善这篇條目,更進一步的信息可能會在討論頁或扩充请求中找到。请在擴充條目後將此模板移除。 卡洛斯·梅内姆阿根廷總統府官方照片第47任阿根廷總統任期1989年7月8日—1999年12月10日副总统爱德华多·杜阿尔德卡洛斯·鲁考夫(英语:Carlos Ruckauf)前任劳尔·阿方辛 个人资料出生(1930-07-02)1930年7月2日 阿根廷拉里奥哈省阿尼利亚科…

此條目可参照英語維基百科相應條目来扩充。 (2021年5月6日)若您熟悉来源语言和主题,请协助参考外语维基百科扩充条目。请勿直接提交机械翻译,也不要翻译不可靠、低品质内容。依版权协议,译文需在编辑摘要注明来源,或于讨论页顶部标记{{Translated page}}标签。 约翰斯顿环礁Kalama Atoll 美國本土外小島嶼 Johnston Atoll 旗幟颂歌:《星條旗》The Star-Spangled Banner約翰斯頓環礁地…

Kedutaan Besar Australia di JakartaAustralian Embassy JakartaGedung kedutaan pada tahun 2016Koordinat6°13′55.5″S 106°50′2.9″E / 6.232083°S 106.834139°E / -6.232083; 106.834139Koordinat: 6°13′55.5″S 106°50′2.9″E / 6.232083°S 106.834139°E / -6.232083; 106.834139Lokasi Jakarta, IndonesiaAlamatJalan Patra Kuningan Raya Kav. 1-4Jakarta SelatanDuta BesarGary Quinlan (en)Chargé d'affairesAllaster CoxSitus webindonesia.embassy.gov.…

Biblioteca Central UNAM UbicaciónPaís MéxicoLocalidad Coyoacán, Ciudad de MéxicoCoordenadas 19°20′01″N 99°11′14″O / 19.333479778578, -99.187095822089Datos generalesTipo Biblioteca UniversitariaFundación 5 de abril de 1956 (68 años)Construcción ? - ?AcervoColecciones del acervo libros, revistas, tesis, obras de consulta, discos compactosTamaño 1'445,109 volúmenes distribuidos en:• 589,418 libros• 323,452 fascículos de revistas• 2,687 folletos…

Great demon in Mesopotamian mythology A depiction taken from an ancient Sumerian language cylinder seal showing the god Dumuzid being tortured in the Underworld by gallas Part of a series onAncientMesopotamian religionChaos Monster and Sun God Religions of the ancient Near East Anatolia Ancient Egypt Mesopotamia Babylonia Sumer Iranian Semitic Arabia Canaan Primordial beings Tiamat and Abzu Lahamu and Lahmu Kishar and Anshar Mummu Seven gods who decree Four primary Anu Enlil Enki Ninhursag Three…

I nostri eroi alla riscossafilm TV d'animazione I protagonisti del cartone Titolo orig.Cartoon All-Stars to the Rescue Lingua orig.inglese PaeseStati Uniti RegiaKaren Peterson Produttore esecutivoRoy E. Disney ProduttoreBuzz Potamkin SceneggiaturaDuane Poole, Tom Swale Dir. artisticaDon Morgan, Takashi MusicheRichard Kosinski, Sam Winans, Paul Buckmaster, Bill Reichenbach, Bob Mann, Guy Moon StudioAcademy of Television Arts & Sciences ReteABC,&#…

Pour les articles homonymes, voir Vague (homonymie). Si ce bandeau n'est plus pertinent, retirez-le. Cliquez ici pour en savoir plus. Cet article ne cite pas suffisamment ses sources (janvier 2023). Si vous disposez d'ouvrages ou d'articles de référence ou si vous connaissez des sites web de qualité traitant du thème abordé ici, merci de compléter l'article en donnant les références utiles à sa vérifiabilité et en les liant à la section « Notes et références ». En prati…

エニセイ川 クラスノヤルスク付近の川岸クラスノヤルスク橋(シベリア鉄道の鉄橋)から延長 5,539 km平均流量 17,380 m³/s流域面積 2,700,000 km²水源の標高 -- m河口・合流先 エニセイ湾(英語版)流域 ロシア モンゴルテンプレートを表示 エニセイ川(エニセイがわ、イェニセイ川、ロシア語: Енисе́й, ブリヤート語: Горлог мүрэн, トゥバ語: Улуг-Хем, ハ…

العلاقات الغابونية البيلاروسية الغابون روسيا البيضاء   الغابون   روسيا البيضاء تعديل مصدري - تعديل   العلاقات الغابونية البيلاروسية هي العلاقات الثنائية التي تجمع بين الغابون وروسيا البيضاء.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومر…

English children's entertainers For the newspaper comic, see Chuckle Bros (comics). Chuckle BrothersBarry (left) and Paul (right) in 2008BornBarry David Elliott(1944-12-24)24 December 1944Rotherham, West Riding of Yorkshire,EnglandPaul Harman Elliott (1947-10-18) 18 October 1947 (age 76)Rotherham, West Riding of Yorkshire,EnglandDiedBarry:5 August 2018(2018-08-05) (aged 73)Rotherham, South Yorkshire, EnglandMedium Television stage Years activeBarry: 1963–2018Paul: 1963–present[…

Ali Adnan KadhimAdnan durante la Coppa d'Asia 2019Nazionalità Iraq Altezza188[1] cm Peso71 kg Calcio RuoloDifensore Squadra Mes Rafsanjan CarrieraGiovanili 2002-2008 Ammo Baba School2008-2009 Al-Zawraa2009-2010 Al-Quwa Al-Jawiya Squadre di club1 2010-2013 Baghdad? (6)2013-2015 Çaykur Rizespor41 (3)2015-2018 Udinese65 (1)2018-2019→  Atalanta3 (0)2019-2021 Vancouver Whitecaps51 (3)2021-2022 Vejle1 (0)2022-2023 Rubin8 (0)2023- …

1999 Bath and North East Somerset Council election ← 1995 6 May 1999 (1999-05-06) 2003 → All 65 seats to Bath and North East Somerset Council33 seats needed for a majority   First party Second party   LD Lab Party Liberal Democrats Labour Last election 27 seats, 36.2% 22 seats, 33.2% Seats won 30 17 Seat change 3 5 Popular vote 34,564 23,394 Percentage 40.3% 27.3% Swing 4.1% 5.9%   Third party Fourth party   Con InLab P…

1983 novel by William Kennedy Ironweed First editionAuthorWilliam KennedyLanguageEnglishGenreTragedy[1]PublisherViking Press, NYPublication date1983Publication placeUnited StatesMedia typePrint (hardback & paperback)Pages227 ppISBN0-670-40176-5OCLC8709244Dewey Decimal813/.54 19LC ClassPS3561.E428 I7 1983Preceded byBilly Phelan's Greatest Game Followed byQuinn's Book  Ironweed is a 1983 novel by American author William Kennedy.[2] Ironweed receive…

Pertempuran Chuenpee KeduaBagian dari Perang Candu PertamaPasukan Inggris bergerak maju di ChuenpiTanggal7 Januari 1841LokasiHumen, Guangdong, Tiongkok22°45′41.45″N 113°39′30.58″E / 22.7615139°N 113.6584944°E / 22.7615139; 113.6584944Hasil Britania Raya menang, Konvensi ChuenpiPerubahanwilayah Charles Elliot mengumumkan penyerahan Pulau Hong Kong kepada Britania Raya1Pihak terlibat Britania Raya Perusahaan Hindia Timur Britania Dinasti QingTokoh dan pemimpin J…

Japanese manga magazine Comic BunchThe final issue of Weekly Comic Bunch, showcasing many of the titles that were being published at the time.CategoriesSeinen manga[1]FrequencyWeekly (2001–2010)Monthly (2011–2024)Circulation140,000 (2010)[2]PublisherShinchoshaFirst issueMay 15, 2001Final issueMarch 21, 2024CompanyShinchoshaCoamix (2001–2010)CountryJapanLanguageJapaneseWebsiteOfficial website Comic Bunch (コミックバンチ, Komikku Banchi)[a] was a Japanese manga…

5-ton 6x6 trucks M809 Series 5-ton 6x6 Truck M813 crossing a riverType5-ton 6x6 trucksPlace of originUnited StatesProduction historyManufacturerAM GeneralProduced1970–1982Specifications (M813 with winch[1])Mass21,020 lb (9,530 kg) (empty)Length26 ft 7 in (8.10 m)Width8 ft 2 in (2.49 m)Height9 ft 9 in (2.97 m)EngineCummins NH250240 hp (180 kW)Transmission5 speed x 2 rangeSuspensionLive beam axles on leaf springsO…

This article may need to be rewritten to comply with Wikipedia's quality standards. You can help. The talk page may contain suggestions. (October 2016) County-level & Sub-prefectural city in Guangdong, People's Republic of ChinaGaozhou 高州市KochowCounty-level & Sub-prefectural cityGaozhouLocation in GuangdongCoordinates: 21°55′28″N 110°50′32″E / 21.92444°N 110.84222°E / 21.92444; 110.84222CountryPeople's Republic of ChinaProvinceGuangdongPrefecture…