code: protected byte[] PBKDF2(PRF prf, byte[] S, int c, int dkLen)
      {
          if (S == null)
          {
              S = new byte[0];
          }
          int hLen = prf.getHLen();
          int l = ceil(dkLen, hLen);
          int r = dkLen - (l - 1) * hLen;
          byte T[] = new byte[l * hLen];
          int ti_offset = 0;
          for (int i = 1; i <= l; i++)
          {
              _F(T, ti_offset, prf, S, c, i);
              ti_offset += hLen;
          }
          if (r < hLen)
          {
              // Incomplete last block
              byte DK[] = new byte[dkLen];
              System.arraycopy(T, 0, DK, 0, dkLen);
              return DK;
          }
          return T;
      }
docs: Core Password Based Key Derivation Function 2.
  
  @see <a href="http://tools.ietf.org/html/rfc2898">RFC 2898 5.2</a>
  @param prf
  Pseudo Random Function (i.e. HmacSHA1)
  @param S
  Salt as array of bytes. <code>null</code> means no salt.
  @param c
  Iteration count (see RFC 2898 4.2)
  @param dkLen
  desired length of derived key.
  @return internal byte array