<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=PBKDF2</id>
	<title>PBKDF2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=PBKDF2"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=PBKDF2&amp;action=history"/>
	<updated>2026-05-15T09:23:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=PBKDF2&amp;diff=2466&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;&lt;amp/&gt; In cryptography, '''PBKDF1''' and '''PBKDF2''' ('''Password-Based Key Derivation Function 2''') are key derivation functions with a sliding computational cost,...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=PBKDF2&amp;diff=2466&amp;oldid=prev"/>
		<updated>2019-03-23T07:35:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;amp/&amp;gt; In &lt;a href=&quot;/index.php?title=Cryptography&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Cryptography (page does not exist)&quot;&gt;cryptography&lt;/a&gt;, &amp;#039;&amp;#039;&amp;#039;PBKDF1&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;PBKDF2&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;Password-Based Key Derivation Function 2&amp;#039;&amp;#039;&amp;#039;) are &lt;a href=&quot;/Key_derivation_function&quot; title=&quot;Key derivation function&quot;&gt;key derivation functions&lt;/a&gt; with a sliding computational cost,...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;amp/&amp;gt;&lt;br /&gt;
In [[cryptography]], '''PBKDF1''' and '''PBKDF2''' ('''Password-Based Key Derivation Function 2''') are [[key derivation function]]s with a sliding computational cost, aimed to reduce the vulnerability of encrypted keys to [[brute force attack]]s. &lt;br /&gt;
&lt;br /&gt;
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. RFC 8018, published in 2017, still recommends PBKDF2 for password hashing, even though newer password hashing functions such as [[Argon2]] are designed to address weaknesses in older functions such as PBKDF2.&lt;br /&gt;
&lt;br /&gt;
== Purpose and operation ==&lt;br /&gt;
PBKDF2 applies a [[pseudorandom function]], such as [[hash-based message authentication code]] (HMAC), to the input [[password]] or [[passphrase]] along with a [[salt (cryptography)|salt]] value and repeats the process many times to produce a ''derived key'', which can then be used as a [[key (cryptography)|cryptographic key]] in subsequent operations. The added computational work makes [[password cracking]] much more difficult, and is known as [[key stretching]].&lt;br /&gt;
&lt;br /&gt;
When the standard was written in the year 2000 the recommended minimum number of iterations was 1000, but the parameter is intended to be increased over time as CPU speeds increase. As of 2005 a Kerberos standard recommended 4096 iterations, Apple iOS 3 used 2000, iOS 4 used , while in 2011 LastPass used 5000 iterations for JavaScript clients and iterations for server-side hashing.&lt;br /&gt;
&lt;br /&gt;
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 standard recommends a salt length of at least 64 bits.&lt;br /&gt;
&lt;br /&gt;
== Key derivation process ==&lt;br /&gt;
The PBKDF2 key derivation function has five input parameters:&lt;br /&gt;
&lt;br /&gt;
 DK = PBKDF2(PRF, Password, Salt, c, dkLen)&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* ''PRF'' is a pseudorandom function of two parameters with output length ''hLen'' (e.g. a keyed HMAC)&lt;br /&gt;
* ''Password'' is the master password from which a derived key is generated&lt;br /&gt;
* ''Salt'' is a sequence of bits, known as a [[cryptographic salt]]&lt;br /&gt;
* ''c'' is the number of iterations desired&lt;br /&gt;
* ''dkLen'' is the desired length of the derived key&lt;br /&gt;
* ''DK'' is the generated derived key&lt;br /&gt;
&lt;br /&gt;
Each ''hLen''-bit block T&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; of derived key DK, is computed as follows (with &amp;lt;code&amp;gt;||&amp;lt;/code&amp;gt; marking string concatenation):&lt;br /&gt;
&lt;br /&gt;
 DK = T&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; || T&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; || ... || T&amp;lt;sub&amp;gt;dklen/hlen&amp;lt;/sub&amp;gt;&lt;br /&gt;
 T&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; = F(Password, Salt, c, i)&lt;br /&gt;
&lt;br /&gt;
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. (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 salt:&lt;br /&gt;
&lt;br /&gt;
 F(Password, Salt, c, i) = U&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; ^ U&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ^ ... ^ U&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
 U&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; = PRF(Password, Salt || INT_32_BE(i))&lt;br /&gt;
 U&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = PRF(Password, U&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;)&lt;br /&gt;
 ...&lt;br /&gt;
 U&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; = PRF(Password, U&amp;lt;sub&amp;gt;c-1&amp;lt;/sub&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
For example, [[WPA2]] uses:&lt;br /&gt;
&lt;br /&gt;
 DK = PBKDF2(HMAC−SHA1, passphrase, ssid, 4096, 256)&lt;br /&gt;
&lt;br /&gt;
==HMAC Collisions ==&lt;br /&gt;
&lt;br /&gt;
PBKDF2 has an interesting property when using HMAC as its pseudo-random function. It is possible to trivially construct any number of resulting collisions for different passwords. 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:&lt;br /&gt;
&lt;br /&gt;
* '''Password:''' &amp;lt;code&amp;gt;plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
therefore (when for example using HMAC&amp;lt;sub&amp;gt;sha1&amp;lt;/sub&amp;gt;) it is pre-hashed using SHA-1 into:&lt;br /&gt;
&lt;br /&gt;
* '''SHA1''' (hex): &amp;lt;code&amp;gt;65426b585154667542717027635463617226672a&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which can be represented in ASCII as:&lt;br /&gt;
&lt;br /&gt;
* '''SHA1''' (ASCII): &amp;lt;code&amp;gt;eBkXQTfuBqp'cTcar&amp;amp;g*&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that PBKDF2&amp;lt;sub&amp;gt;hmac&amp;lt;/sub&amp;gt; will generate the same key bytes for the passwords:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd&amp;quot;&lt;br /&gt;
* &amp;quot;eBkXQTfuBqp'cTcar&amp;amp;g*&amp;quot;&lt;br /&gt;
&lt;br /&gt;
regardless of the hashing function (e.g. sha1, sha256), salt, or iterations. &lt;br /&gt;
&lt;br /&gt;
For example, using:&lt;br /&gt;
&lt;br /&gt;
* '''PRF''': PBKDF2&amp;lt;sub&amp;gt;HMAC-SHA1&amp;lt;/sub&amp;gt;&lt;br /&gt;
* '''Salt:''' A009C1A485912C6AE630D3E744240B04&lt;br /&gt;
* '''Iterations:''' 1,000&lt;br /&gt;
* '''Desired key length:''' 16 bytes&lt;br /&gt;
&lt;br /&gt;
the following two function calls:&lt;br /&gt;
&lt;br /&gt;
 PBKDF2&amp;lt;sub&amp;gt;HMAC-SHA1&amp;lt;/sub&amp;gt;(&amp;quot;plnlrtfpijpuhqylxbgqiiyipieyxvfsavzgxbbcfusqkozwpngsyejqlmjsytrmd&amp;quot;, ...)&lt;br /&gt;
 PBKDF2&amp;lt;sub&amp;gt;HMAC-SHA1&amp;lt;/sub&amp;gt;(&amp;quot;eBkXQTfuBqp'cTcar&amp;amp;g*&amp;quot;, ...) &lt;br /&gt;
&lt;br /&gt;
will generate the same derived key bytes (&amp;lt;code&amp;gt;17EB4014C8C461C300E9B61518B9A18B&amp;lt;/code&amp;gt;). These derived key collisions do not represent a security vulnerability; as you still must know the original password in order to generate the ''hash'' of the password. The presence of the collisions becomes a mere curiosity.&lt;br /&gt;
&lt;br /&gt;
==Alternatives to PBKDF2==&lt;br /&gt;
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 circuit]]s or [[graphics processing unit]]s relatively cheap. The [[bcrypt]] key derivation function requires a larger amount of RAM (but still not tunable separately, i.&amp;amp;thinsp;e. fixed for a given amount of CPU time) and is slightly stronger against such attacks, 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.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
[http://wikipedia.org/ http://wikipedia.org/]&lt;br /&gt;
&lt;br /&gt;
[[Category:Cryptography]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>