title: PBKDF2WithHmacSHA256 impact of key length to the output length
body: <p>Consider the following java code:</p>
  
  <pre><code>KeySpec spec = new PBEKeySpec("pass".toCharArray(), "salt".getBytes(),
      10000, 512);
  SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
  System.out.println(f.generateSecret(spec).getEncoded().length);
  </code></pre>
  
  <p>This code outputs "<code>64</code>". So 64 bytes, while SHA-256 is a 32 byte hash.</p>
  
  <p>I know I specified 512 bits (64 byte) as the key length.<br>
  However I would <strong>expect</strong> that the generated key
  (PBKDF2) will be hashed by SHA-256 so that the <strong>output should always be 32 bytes, irrespective what key size I am using.</strong></p>
  
  <p>What I am missing (or why are my expectations wrong)?</p>