Java - PBKDF2 with HMACSHA256 as the PRF

后端 未结 2 1918
-上瘾入骨i
-上瘾入骨i 2020-12-13 22:00

I\'ve been given the task of creating a Login API for our project and I\'m supposed to use PBKDF2 with HMACSHA256 as the PRF. The plain text password is hashed using MD5 an

2条回答
  •  无人及你
    2020-12-13 22:11

    The generation of int l seems wrong. You have specified the maximum between dkLen and hLen but the spec says l = CEIL (dkLen / hLen) with

    CEIL (x) is the "ceiling" function, i.e. the smallest integer greater than, or equal to, x.

    I think l would be more accurately defined as l = (int)Math.ceil( (double)dkLen / (double)hLen )

提交回复
热议问题