[GH-ISSUE #873] Convert pbkdf2_*.h into proper functions and add *_ZEROS logic where possible #479

Open
opened 2026-10-14 03:10:00 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @jfoug on GitHub (Dec 9, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/873

Several issues here.

  1. create a proper .h file that defines the available functions
  2. create a .c file that has all these functions as globals.
  3. NOTE, there may be several versions for some hashes:
    i.e. pbkdf2_hmac_sha256, pbkdf1_hmac_sha256, pbkdf2_hmac_sha256_efs would be available in the sha256 file.
    These extra functions probably should be able to be done with #include of the code again, with a couple #defines.
  4. modify any external .c files including this, where the function name would change. (such as pbkdf1, or the _efs variants)
  5. add any 'missing' pbkdf1_* functions to the hashes.
  6. Add any additional crypts (such as BF)
  7. add *ZEROS logic where we can. The *_ZEROS logic would be in the inner loop of the pbkdf2 run, where we KNOW a large part of the input data is null bytes.
Originally created by @jfoug on GitHub (Dec 9, 2014). Original GitHub issue: https://github.com/openwall/john/issues/873 Several issues here. 1. create a proper .h file that defines the available functions 2. create a .c file that has all these functions as globals. 3. NOTE, there may be several versions for some hashes: i.e. pbkdf2_hmac_sha256, pbkdf1_hmac_sha256, pbkdf2_hmac_sha256_efs would be available in the sha256 file. These extra functions probably should be able to be done with #include of the code again, with a couple #defines. 4. modify any external .c files including this, where the function name would change. (such as pbkdf1, or the _efs variants) 5. add any 'missing' pbkdf1_\* functions to the hashes. 6. Add any additional crypts (such as BF) 7. add *ZEROS logic where we can. The *_ZEROS logic would be in the inner loop of the pbkdf2 run, where we KNOW a large part of the input data is null bytes.
Author
Owner

@magnumripper commented on GitHub (Jul 22, 2015):

In OpenCL we have the SHA1 "ZEROS" functions as SHA1_160Z (for 160 bits of input, eg. PBKDF2-HMAC-SHA1) and SHA1_192Z (for 192 bits of input, ie. Office 2007/2010 formats).

For SHA256 there's just SHA256_ZEROS (256 bits of input) and it's for PBKDF2 (no Office format uses SHA256).

For SHA512 there's just SHA512_ZEROS but it's actually for up to 575 bits of input in order to fit Office2013 too (so the PBKDF2 format has to declare W[8] and set it to 0x8000000000000000UL and both need to set W[15] accordingly). We should have separate SHA512_512Z() and SHA512_544Z() to get best of both worlds.

<!-- gh-comment-id:123536034 --> @magnumripper commented on GitHub (Jul 22, 2015): In OpenCL we have the SHA1 "ZEROS" functions as SHA1_160Z (for 160 bits of input, eg. PBKDF2-HMAC-SHA1) and SHA1_192Z (for 192 bits of input, ie. Office 2007/2010 formats). For SHA256 there's just SHA256_ZEROS (256 bits of input) and it's for PBKDF2 (no Office format uses SHA256). For SHA512 there's just SHA512_ZEROS but it's actually for up to 575 bits of input in order to fit Office2013 too (so the PBKDF2 format has to declare W[8] and set it to 0x8000000000000000UL and both need to set W[15] accordingly). We should have separate SHA512_512Z() and SHA512_544Z() to get best of both worlds.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#479
No description provided.