[GH-ISSUE #2915] Unification and Common helper code for SIMD usage in formats #1841

Open
opened 2026-10-15 04:26:26 +07:00 by bsakaguchi · 17 comments
Owner

Originally created by @jfoug on GitHub (Nov 22, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2915

Lets first talk about what we think we can do. How easy each task is, and just how it can be done.

  • GETPOS (and other macros) unification into 1 or 2 header files
  • set_key common code (even if just common 'parts' are done with macros or inlines
  • update fmt_default_* methods ?? not sure here.
  • possbile common code for split possible case unification, and may handle 'tags', etc
  • cmp_[all][one] commonality. Possibly even cmp_exact for some formats.
Originally created by @jfoug on GitHub (Nov 22, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2915 Lets first talk about what we think we can do. How easy each task is, and just how it can be done. - [x] GETPOS (and other macros) unification into 1 or 2 header files - [x] set_key common code (even if just common 'parts' are done with macros or inlines - [ ] update fmt_default_* methods ?? not sure here. - [ ] possbile common code for split possible case unification, and may handle 'tags', etc - [ ] cmp_[all][one] commonality. Possibly even cmp_exact for some formats.
Author
Owner

@magnumripper commented on GitHub (Nov 22, 2017):

Moving any dupe function-like macros into a header is a good idea. Perhaps jumbo_macros.h, containing nothing but macros?

Shared actual functions could be sth like jumbo_shared_funcs.[ch]. A shared set_key() might be harder than it sounds due to small but important differences, but adding macros for parts of it (eg. the hairy parts of 32-bit SIMD key setup that was discussed recently) is likely a good idea.

We do have shared fmt_default_binary_hash_x functions. Some of the many split() functions that do nothing but unify case might be shared - especially if we unify format tags code first (we may already have done everything needed during the last year or so). I believe a huge number of cmp_(all|one|exact) jumbo functions are 100% identical.

<!-- gh-comment-id:346485658 --> @magnumripper commented on GitHub (Nov 22, 2017): Moving any dupe function-like macros into a header is a good idea. Perhaps `jumbo_macros.h`, containing nothing but macros? Shared actual functions could be sth like `jumbo_shared_funcs.[ch]`. A shared `set_key()` might be harder than it sounds due to small but important differences, but adding macros for *parts* of it (eg. the hairy parts of 32-bit SIMD key setup that was discussed recently) is likely a good idea. We do have shared fmt_default_binary_hash_x functions. Some of the many `split()` functions that do nothing but unify case might be shared - especially if we unify format tags code first (we may already have done everything needed during the last year or so). I believe a huge number of `cmp_(all|one|exact)` jumbo functions are 100% identical.
Author
Owner

@magnumripper commented on GitHub (Nov 22, 2017):

A propos macros, I really wish typeof() was a C99 standard. Not to mention an OpenCL standard. It isn't, but in OpenCL it would open up for a LOT of simplification. There could be eg. just one swap macro solving all widths of vectors and sizes of integers.

<!-- gh-comment-id:346486222 --> @magnumripper commented on GitHub (Nov 22, 2017): A propos macros, I really wish `typeof()` was a C99 standard. Not to mention an OpenCL standard. It isn't, but in OpenCL it would open up for a LOT of simplification. There could be eg. just one swap macro solving all widths of vectors and sizes of integers.
Author
Owner

@magnumripper commented on GitHub (Nov 22, 2017):

Most formats already include jumbo.h so if we introduce jumbo_macros.h and/or jumbo_shared_funcs.h we should probably source them from jumbo.h.

<!-- gh-comment-id:346487705 --> @magnumripper commented on GitHub (Nov 22, 2017): Most formats already include jumbo.h so if we introduce jumbo_macros.h and/or jumbo_shared_funcs.h we should probably source them from jumbo.h.
Author
Owner

@jfoug commented on GitHub (Nov 22, 2017):

Here would be a stab at the macros for SIMD stuff. Once done, in the code for the format, simply do this:

#define GETPOS   GETPOS_MD5
#define GETPOSW  GETPOS_MD5W

// then in code, whenever we want the uint32* limb, use the GETPOSW and not GETPOS.
// GETPOSW also is the int32 count,  not the byte count to the offset of the item.  If we use
// normal GETPOS, then you have to use 2 different offsets to get the right uint32, depending
// upon BE or LE machine, AND BE or LE format.  It is very confusing. The GETPOS works just
// like it does today, but will be machine independant, and setup right for all hash types.
// in fact, the GETPOS setting in the format does not need to be wrapped in an 
// #if SIMD_COEF_32 wrapper, if we do not want to force that ;)
// header
#if !defined(SIMD_COEF_32)
#define GETPOS_MD5
#define GETPOS_MD5W
#define GETOUTPOS_MD5
#define GETOUTPOS_MD5W
#define GETPOS_SHA1
// ....
#else // SIMD_COEF_32 defined
#define GETPOS_MD5W(i, index)     ( (index&(SIMD_COEF_32-1))*4 + ((i<<2)&(0xffffffff-3))*SIMD_COEF_32 + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 )
#define GETOUTPOS_MD5W(i, index)  ( (index&(SIMD_COEF_32-1))*4 + ((i<<2)&(0xffffffff-3))*SIMD_COEF_32 + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 )
#if ARCH_LITTLE_ENDIAN
#define GETPOS_MD5(i, index)      ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + ((i)&3) + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 )
#define GETOUTPOS_MD5(i, index)   ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + ((i)&3) + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 )
#else
#define GETPOS_MD5(i, index)      ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + (3-((i)&3)) + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 )
#define GETOUTPOS_MD5(i, index)   ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + (3-((i)&3)) + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 )
#endif
// ...   same type stuff for all other 32 bit SIMD algos.
#endif // SIMD_COEF_32

#if !defined (SIMD_COEF_64
//.....  same stuff for 64 bit formats
<!-- gh-comment-id:346493976 --> @jfoug commented on GitHub (Nov 22, 2017): Here would be a stab at the macros for SIMD stuff. Once done, in the code for the format, simply do this: ```c #define GETPOS GETPOS_MD5 #define GETPOSW GETPOS_MD5W // then in code, whenever we want the uint32* limb, use the GETPOSW and not GETPOS. // GETPOSW also is the int32 count, not the byte count to the offset of the item. If we use // normal GETPOS, then you have to use 2 different offsets to get the right uint32, depending // upon BE or LE machine, AND BE or LE format. It is very confusing. The GETPOS works just // like it does today, but will be machine independant, and setup right for all hash types. // in fact, the GETPOS setting in the format does not need to be wrapped in an // #if SIMD_COEF_32 wrapper, if we do not want to force that ;) ``` ```c // header #if !defined(SIMD_COEF_32) #define GETPOS_MD5 #define GETPOS_MD5W #define GETOUTPOS_MD5 #define GETOUTPOS_MD5W #define GETPOS_SHA1 // .... #else // SIMD_COEF_32 defined #define GETPOS_MD5W(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i<<2)&(0xffffffff-3))*SIMD_COEF_32 + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 ) #define GETOUTPOS_MD5W(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i<<2)&(0xffffffff-3))*SIMD_COEF_32 + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 ) #if ARCH_LITTLE_ENDIAN #define GETPOS_MD5(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + ((i)&3) + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 ) #define GETOUTPOS_MD5(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + ((i)&3) + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 ) #else #define GETPOS_MD5(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + (3-((i)&3)) + (unsigned int)index/SIMD_COEF_32*MD5_BUF_SIZ*4*SIMD_COEF_32 ) #define GETOUTPOS_MD5(i, index) ( (index&(SIMD_COEF_32-1))*4 + ((i)&(0xffffffff-3))*SIMD_COEF_32 + (3-((i)&3)) + (unsigned int)index/SIMD_COEF_32*MD5_BIN_SIZ*4*SIMD_COEF_32 ) #endif // ... same type stuff for all other 32 bit SIMD algos. #endif // SIMD_COEF_32 #if !defined (SIMD_COEF_64 //..... same stuff for 64 bit formats ```
Author
Owner

@jfoug commented on GitHub (Nov 22, 2017):

Note the above does not take into account 'SIMD_PARA_XXX' it likely may need to, OR we may want to have separate PARA types (so GETPOS_PARA_MD5, etc) Some formats want para, others handle it differently. If the format uses array items to hide para, I do think it cuts down on some of the math. But in all actuality, I think the above listed GETPOS work no matter what the SIMD_PARA_XXX is set to. But we may want to add macros to get to the first para pointer (i.e the actual buffer), then 2nd para block, the 3rd. If that logic is needed, putting it into the common code is the way to go, so that others do not have to cut/paste code, or figure it out from scratch.

<!-- gh-comment-id:346494823 --> @jfoug commented on GitHub (Nov 22, 2017): Note the above does not take into account 'SIMD_PARA_XXX' it likely may need to, OR we may want to have separate PARA types (so GETPOS_PARA_MD5, etc) Some formats want para, others handle it differently. If the format uses array items to hide para, I do think it cuts down on some of the math. But in all actuality, I think the above listed GETPOS work no matter what the SIMD_PARA_XXX is set to. But we may want to add macros to get to the first para pointer (i.e the actual buffer), then 2nd para block, the 3rd. If that logic is needed, putting it into the common code is the way to go, so that others do not have to cut/paste code, or figure it out from scratch.
Author
Owner

@jfoug commented on GitHub (Nov 22, 2017):

For 'some' of them, we may want independent headers, that we simply include inline. Things like the hairy set_key stuff. Simply have set key be

void set_key(char *key, int idx) {
#if SIMD_COEF_32
#   include "jumbo_helper_simd_setkey_ansi.h
#else
   strcpy(plaintext, key);
#endif
}

(Note the above is missing a lot, but you get the point.)

For this type code to work, we would need to unify the SIMD names, the param names of set_key, etc. BUT in the long run, making them standard IS a good thing. Just a bit painful but it WILL be worth it, allowing code to be easier to read in the end.

Hell for that matter, if we can get things unified enough, we might be able to replace the entire function with this:

#include "jumbo_helper_setkey_ansi.h"

and that header includes the entire set_key 'default' function. We may also be able to do a bit of 'adjustment' using #defines prior to the include, and those are #undef at the bottom of the header, so as to not pollute the define space except for that include.

<!-- gh-comment-id:346495314 --> @jfoug commented on GitHub (Nov 22, 2017): For 'some' of them, we may want independent headers, that we simply include inline. Things like the hairy set_key stuff. Simply have set key be ```c void set_key(char *key, int idx) { #if SIMD_COEF_32 # include "jumbo_helper_simd_setkey_ansi.h #else strcpy(plaintext, key); #endif } ``` (Note the above is missing a lot, but you get the point.) For this type code to work, we would need to unify the SIMD names, the param names of set_key, etc. BUT in the long run, making them standard IS a good thing. Just a bit painful but it WILL be worth it, allowing code to be easier to read in the end. Hell for that matter, if we can get things unified enough, we might be able to replace the entire function with this: ```c #include "jumbo_helper_setkey_ansi.h" ``` and that header includes the entire set_key 'default' function. We may also be able to do a bit of 'adjustment' using #defines prior to the include, and those are #undef at the bottom of the header, so as to not pollute the define space except for that include.
Author
Owner

@jfoug commented on GitHub (Nov 23, 2017):

It may not be bad to simply choose a handful of formats (raws, salted, possibly some with unicode, etc), and simply set out to see just how easily (and efficiently) common code can be done. Then simply build from there.

But in the end, we may have to put a bit more of a grading system on formats. Anyone is allowed to submit a format. It can be used. Then it becomes normalized, and brought 'into' the system, using common stuff. Now, should we put the onus of that work on the original developer? I know that @kholia is pretty much THE person to build formats. But I think once we get things started, I bet he would be able to produce formats 'using' the common code, if it ends up actually being much easier than roll-your-own coding like done today.

<!-- gh-comment-id:346507979 --> @jfoug commented on GitHub (Nov 23, 2017): It may not be bad to simply choose a handful of formats (raws, salted, possibly some with unicode, etc), and simply set out to see just how easily (and efficiently) common code can be done. Then simply build from there. But in the end, we may have to put a bit more of a grading system on formats. Anyone is allowed to submit a format. It can be used. Then it becomes normalized, and brought 'into' the system, using common stuff. Now, should we put the onus of that work on the original developer? I know that @kholia is pretty much THE person to build formats. But I think once we get things started, I bet he would be able to produce formats 'using' the common code, if it ends up actually being much easier than roll-your-own coding like done today.
Author
Owner

@kholia commented on GitHub (Nov 23, 2017):

I will be very happy to use the shared code :-)

<!-- gh-comment-id:346525846 --> @kholia commented on GitHub (Nov 23, 2017): I will be very happy to use the shared code :-)
Author
Owner

@jfoug commented on GitHub (Nov 24, 2017):

should probably source them from jumbo.h.

Possibly when 'done'. But if you put it there, then it is all or nothing. If you have code which still sets its own GETPOS, or something, then that might cause conflict.

Since EACH format will have to be tweaked some (or a lot0 to get this incorporated, I think having stand alone header include may be better. Also, it would have to be placed in the right order. You would want to have simd-intrinsics.h included first (I think), but I do not think you would want the circular include issues. I would really have to play with it a bit and see what would work best.

Once we do get thing fully installed, then it may likely BE an ideal location, to simply have jumbo.h do the inclusion of declare stuff.

<!-- gh-comment-id:346875425 --> @jfoug commented on GitHub (Nov 24, 2017): > should probably source them from jumbo.h. Possibly when 'done'. But if you put it there, then it is all or nothing. If you have code which still sets its own GETPOS, or something, then that might cause conflict. Since EACH format will have to be tweaked some (or a lot0 to get this incorporated, I think having stand alone header include may be better. Also, it would have to be placed in the right order. You would want to have simd-intrinsics.h included first (I think), but I do not think you would want the circular include issues. I would really have to play with it a bit and see what would work best. Once we do get thing fully installed, then it may likely BE an ideal location, to simply have jumbo.h do the inclusion of declare stuff.
Author
Owner

@magnumripper commented on GitHub (Nov 24, 2017):

All our headers (unless they're buggy) have circular include protection, so jumbo_macros.h should definitely source simd-intrinsics.h

<!-- gh-comment-id:346883653 --> @magnumripper commented on GitHub (Nov 24, 2017): All our headers (unless they're buggy) have circular include protection, so jumbo_macros.h should definitely source simd-intrinsics.h
Author
Owner

@magnumripper commented on GitHub (Nov 25, 2017):

The patches should be in a topic branch and a PR. That will remind me and others to review it - and we can comment inline. Not to mention we can actually check the branch out and test it - and the bots would test it too!

<!-- gh-comment-id:346962509 --> @magnumripper commented on GitHub (Nov 25, 2017): The patches should be in a topic branch and a PR. That will remind me and others to review it - and we can comment inline. Not to mention we can actually check the branch out and test it - and the bots would test it too!
Author
Owner

@jfoug commented on GitHub (Dec 1, 2017):

I have placed a PR #2949 Which adds a common header file for the GETPOS logic (and finding right indexed word in the key, AND in output buffers).

Also, built a pair of 'common' code headers, that defines setkey() / getkey() and can be included in all of the formats which use complex SIMD intermixing logic. NOTE, does not handle intermixed Unicode formats (nor the hmac formats). This reduces the code a lot (removing the setkey from the source, and putting it into header). Unfortunately, the actual compiled code is still the same size (almost), since the 2 functions are STILL simply static functions within the format itself.

These format files have been converted to use the new header
XSHA512_fmt_plug.c
XSHA_fmt_plug.c
citrix_ns_fmt_plug.c
mysqlSHA1_fmt_plug.c
oracle11_fmt_plug.c
rawMD4_fmt_plug.c
rawMD5_fmt_plug.c
rawSHA1_fmt_plug.c
rawSHA1_linkedIn_fmt_plug.c
rawSHA224_fmt_plug.c
rawSHA256_fmt_plug.c
rawSHA384_fmt_plug.c
rawSHA512_fmt_plug.c
salted_sha1_fmt_plug.c
ssha512_fmt_plug.c

There is still a lot of formats left to convert to use the GETPOS common header.

Now, since these ARE includes, and they do have to handle formats that have slightly different requirements. Some have array of non-simd hashes, some a single. Some save the length in saved_len, some do not (some saved_len is an array, some a single flat var). Also some formats are salted (some append, some prepend the salt). ALL of these nuances are handled, by setting #define's before including the header. The defines are documented within the 2 header files themselves.

For the GETPOS header, there is only 1 define. That is #define FMT_IS_BE which must be set before including that file for any BE format (the SHAx are BE). This is because the endianity swapping logic has to know the difference. Also within GETPOS, it does use the ARCH_LITTLE_ENDIAN to also adjust behavior, so that the macros work properly no matter what hash is used, and no matter if building on BE or LE machine. The #define FMT_IS_BE is also used within the common-simd-setkey*.h file, BUT since the GETPOS header is included first, and must have the FMT_IS_BE set properly, then that define will already be setup so is not needed to be set again before the common-simd-setkey header include.

<!-- gh-comment-id:348500661 --> @jfoug commented on GitHub (Dec 1, 2017): I have placed a PR #2949 Which adds a common header file for the GETPOS logic (and finding right indexed word in the key, AND in output buffers). Also, built a pair of 'common' code headers, that defines setkey() / getkey() and can be included in all of the formats which use complex SIMD intermixing logic. NOTE, does not handle intermixed Unicode formats (nor the hmac formats). This reduces the code a lot (removing the setkey from the source, and putting it into header). Unfortunately, the actual compiled code is still the same size (almost), since the 2 functions are STILL simply static functions within the format itself. These format files have been converted to use the new header XSHA512_fmt_plug.c XSHA_fmt_plug.c citrix_ns_fmt_plug.c mysqlSHA1_fmt_plug.c oracle11_fmt_plug.c rawMD4_fmt_plug.c rawMD5_fmt_plug.c rawSHA1_fmt_plug.c rawSHA1_linkedIn_fmt_plug.c rawSHA224_fmt_plug.c rawSHA256_fmt_plug.c rawSHA384_fmt_plug.c rawSHA512_fmt_plug.c salted_sha1_fmt_plug.c ssha512_fmt_plug.c There is still a lot of formats left to convert to use the GETPOS common header. Now, since these ARE includes, and they do have to handle formats that have slightly different requirements. Some have array of non-simd hashes, some a single. Some save the length in saved_len, some do not (some saved_len is an array, some a single flat var). Also some formats are salted (some append, some prepend the salt). ALL of these nuances are handled, by setting #define's before including the header. The defines are documented within the 2 header files themselves. For the GETPOS header, there is only 1 define. That is ```#define FMT_IS_BE``` which must be set before including that file for any BE format (the SHAx are BE). This is because the endianity swapping logic has to know the difference. Also within GETPOS, it does use the ARCH_LITTLE_ENDIAN to also adjust behavior, so that the macros work properly no matter what hash is used, and no matter if building on BE or LE machine. The ```#define FMT_IS_BE``` is also used within the common-simd-setkey*.h file, BUT since the GETPOS header is included first, and must have the FMT_IS_BE set properly, then that define will already be setup so is not needed to be set again before the common-simd-setkey header include.
Author
Owner

@jfoug commented on GitHub (Dec 2, 2017):

The set_key is marked as done. We 'could' do the same for set_key utf8 formats. that might be a bit hairier than the normal ASCII formats, I am not sure. these are the ones I think we could do:

ntlmv1_mschapv2
nt2
mssql-old
mssql05
mssql12

This one possibly not (it uses some strange 16x buffers)
nt (ansi, CP, utf8, larger buffers 16x on AVX2)

Now, the hmac-* also have mixed SIMD set-key, but i do not think we can generalize them, and unless we are going to have multiple hmac-md5-* hashes, I do not think there is ANY gain trying to move the code out from the format.

This change does make debugging a bit different. If you have to debug the set_key, you can place the dump_stuff_mmx (or dump_stuff) into the header file. Yes, all formats using the set_key header would be impacted, but that really does not matter when debugging, other than more formats will get rebuilt.

The same goes for debugging on the get_hash() common code. If we wanted, we can EASILY put debugging into common_code_gethash_0, but again, then ALL formats get that debugging. Not a huge thing due to usually a bug is only in 1 format, so you add the debug code, build then test that format fixing it, and then remove the debug code prior to any check in.

So the ability to debug is still 100% there, just a bit different.

<!-- gh-comment-id:348719128 --> @jfoug commented on GitHub (Dec 2, 2017): The set_key is marked as done. We 'could' do the same for set_key utf8 formats. that might be a bit hairier than the normal ASCII formats, I am not sure. these are the ones I think we could do: ntlmv1_mschapv2 nt2 mssql-old mssql05 mssql12 This one possibly not (it uses some strange 16x buffers) nt (ansi, CP, utf8, larger buffers 16x on AVX2) Now, the hmac-* also have mixed SIMD set-key, but i do not think we can generalize them, and unless we are going to have multiple hmac-md5-* hashes, I do not think there is ANY gain trying to move the code out from the format. This change does make debugging a bit different. If you have to debug the set_key, you can place the dump_stuff_mmx (or dump_stuff) into the header file. Yes, all formats using the set_key header would be impacted, but that really does not matter when debugging, other than more formats will get rebuilt. The same goes for debugging on the get_hash() common code. If we wanted, we can EASILY put debugging into common_code_gethash_0, but again, then ALL formats get that debugging. Not a huge thing due to usually a bug is only in 1 format, so you add the debug code, build then test that format fixing it, and then remove the debug code prior to any check in. So the ability to debug is still 100% there, just a bit different.
Author
Owner

@jfoug commented on GitHub (Dec 2, 2017):

The get_hash can also likely be enhanced to handle the formats with reversing logic in them, which does not grab element 0. At the same time, it might also be nice to add the code for binary_hash functionality, especially for these type instances. I also skipped some get_hash which deal with uint64_t* types, but that also could be added (and would need the same extra helper code in the binary_hash to match).

I first wanted to get the 95% 'easy' ones done first. Then the others can be added. I do not want to get the includes SO complex, that others can not use them. I would rather they could not be used in a few cases, but we less enough complex that anyone could see how to use them and get the benefits. If i do the non offset 0, and 64 bit, they will likely end up in their own headers, just so the MOST COMMON case doe not get any more complex than it is. In all actuality, the code for get_hash is pretty trivial, and makes it super easy to get the proper hashing for normal hash types.

<!-- gh-comment-id:348721375 --> @jfoug commented on GitHub (Dec 2, 2017): The get_hash can also likely be enhanced to handle the formats with reversing logic in them, which does not grab element 0. At the same time, it might also be nice to add the code for binary_hash functionality, especially for these type instances. I also skipped some get_hash which deal with uint64_t* types, but that also could be added (and would need the same extra helper code in the binary_hash to match). I first wanted to get the 95% 'easy' ones done first. Then the others can be added. I do not want to get the includes SO complex, that others can not use them. I would rather they could not be used in a few cases, but we less enough complex that anyone could see how to use them and get the benefits. If i do the non offset 0, and 64 bit, they will likely end up in their own headers, just so the MOST COMMON case doe not get any more complex than it is. In all actuality, the code for get_hash is pretty trivial, and makes it super easy to get the proper hashing for normal hash types.
Author
Owner

@jfoug commented on GitHub (Dec 19, 2017):

I would like to start investigating the 'common' code for cmp_all, cmp_one, cmp_exact I know @kholia has been doing some OMP retooling. I will not start until that code is completed and stable. @kholia where are you on that project?

<!-- gh-comment-id:352802734 --> @jfoug commented on GitHub (Dec 19, 2017): I would like to start investigating the 'common' code for cmp_all, cmp_one, cmp_exact I know @kholia has been doing some OMP retooling. I will not start until that code is completed and stable. @kholia where are you on that project?
Author
Owner

@kholia commented on GitHub (Dec 19, 2017):

@kholia where are you on that project?

Almost done. PR https://github.com/magnumripper/JohnTheRipper/pull/3030 is in progress, and we should be all set once that is merged.

<!-- gh-comment-id:352810914 --> @kholia commented on GitHub (Dec 19, 2017): > @kholia where are you on that project? Almost done. PR https://github.com/magnumripper/JohnTheRipper/pull/3030 is in progress, and we should be all set once that is merged.
Author
Owner

@jfoug commented on GitHub (Dec 19, 2017):

Great. I am farting around with some code now. Might do all of the raw stuff.

I only plan on doing cmp_all and cmp_one It looks like cmp_exact often is format specific, so I think I will only do the other 2. I will also only write this for a format which is dual SIMD/CTX logic. No real gain for doing formats that are only CTX, or that are unique in layout (like the DES formats). These functions will be done for 'normal' crypt_out data, and which have a matching binary. It should also be pretty easy to do the reversed hashes, by simply having another define that is the offset variable to check (so you check element 3 and not element 0, etc).

It takes a bit to get the plumbing done, and then I will simply work through the formats, finding the ones which can be utilized.

<!-- gh-comment-id:352814764 --> @jfoug commented on GitHub (Dec 19, 2017): Great. I am farting around with some code now. Might do all of the raw stuff. I only plan on doing cmp_all and cmp_one It looks like cmp_exact often is format specific, so I think I will only do the other 2. I will also only write this for a format which is dual SIMD/CTX logic. No real gain for doing formats that are only CTX, or that are unique in layout (like the DES formats). These functions will be done for 'normal' crypt_out data, and which have a matching binary. It should also be pretty easy to do the reversed hashes, by simply having another define that is the offset variable to check (so you check element 3 and not element 0, etc). It takes a bit to get the plumbing done, and then I will simply work through the formats, finding the ones which can be utilized.
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#1841
No description provided.