mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #809] Add missing salt_hash() functions #425
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#425
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Oct 16, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/809
I hope I'm doing this wrong because this is a LOT of formats 😢
OTOH many of the below are "salt-only" non-hashes so doesn't benefit that much of a hash function.
@magnumripper commented on GitHub (Oct 17, 2014):
A canonical salt_hash() could be as follows
However, this is only reliable for fixed-size salts (ie. where we are sure all of SALT_SIZE is really initialized in
salt()). Otherwise we need to use something like salt->len instead of SALT_SIZE. Alternatively, there needs to be a memset() in salt() that guarantees nothing in uninitialized.@magnumripper commented on GitHub (Oct 17, 2014):
Now, we could change fmt_default_salt_hash() to be like above. That is kinda dangerous but our recently added self-test for salt cleaning should ensure proper function...
...oh, and it can't really be like above, because the SALT_SIZE macro won't be available in formats.c.
@kholia commented on GitHub (Oct 17, 2014):
👍
@kholia commented on GitHub (Oct 17, 2014):
I really don't want to write such boilerplate code in every format (well, the real reason is that I am a bit lazy).
@magnumripper commented on GitHub (Oct 28, 2014):
One option is to add a file salt_hash.c that contains the function as above. Any format that wants to use it (and that fits the requirement that if SALT_SIZE has a margin for variable length, the full size HAS to be 'cleaned' for each call to get_salt()) could just
#include "salt_hash.c"and then saysalt_hashin the format struct definition.@frank-dittrich commented on GitHub (Oct 28, 2014):
I'd prefer to put those functions into a .h file.
There are already some other .h files which include function implementations.
BTW: There are other possible "helper functions" which could be reused this way:
-functions verifying that certain ciphertexts elements contain hex values of a given length (range))
-functions for base64 verification
@magnumripper commented on GitHub (Oct 28, 2014):
Calling it .h is fine with me. But those ifdefs (that are normally crucial for headers) will not do any good in this case, they would just hide bugs.
@magnumripper commented on GitHub (Oct 28, 2014):
Changing this from bug->enhancement because it really does not affect anything but loader performance. If that.
@magnumripper commented on GitHub (Feb 12, 2015):
I see no important format among the current list. And this is only about loading a LOT of salts/hashes. Closing.
@ghost commented on GitHub (Sep 5, 2018):
These files use
SALT_SIZEdefinition from a header; anyway, they are doing the same as the CPU versions do.