[GH-ISSUE #1627] Add Unicode support to incremental #1072

Open
opened 2026-10-14 03:34:02 +07:00 by bsakaguchi · 12 comments
Owner

Originally created by @jfoug on GitHub (Aug 9, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1627

I know this one will sit a long while (likely), but lets get these documented as wish list items.

Btw, incremental 'does' work in a limited subset for utf-8. It can handle 2 and 3 char utf8 pretty well, but it does not know anything about the encoding system. It simply works because of internal tri-glyph logic. So those 3 (or 2) bytes of utf-8 get seen as a very often used 3 (or 2) character substring and thus become very highly likely to be output. But that does not mean inc does utf-8.

Originally created by @jfoug on GitHub (Aug 9, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1627 I know this one will sit a long while (likely), but lets get these documented as wish list items. Btw, incremental 'does' work in a limited subset for utf-8. It can handle 2 and 3 char utf8 pretty well, but it does not know anything about the encoding system. It simply works because of internal tri-glyph logic. So those 3 (or 2) bytes of utf-8 get seen as a very often used 3 (or 2) character substring and thus become very highly likely to be output. But that does not mean inc does utf-8.
Author
Owner

@jfoug commented on GitHub (Aug 9, 2015):

Note, we 'might' be able to squeeze this logic into existing --make-charset but we may also need to add a supplement, and possibly even change the version of the chr file format for this. I would say current chr format version is kept for all <= 8 bit chr files (and john reads them in), but a new version is created for > 8bit chr files. It may simply be that we build 16bit chr files and 32bit chr files. Then when building them, simply convert the utf into proper 'character', and if all characters fit in 8 bit, we do an 8 bit file (this would include any 'code page' input), if all utf8 fit into 16 bits, we build a 16 bit format and if all fit into 32bit, we build a 32bit format. Then upon running it is simple again. Just an array of characters (like we have now), and whatever probability crap goes with them. It would just be that upon completion of the word, the inc code would have to convert from UTF16 into utf8 (if that is the encoding)

<!-- gh-comment-id:129199668 --> @jfoug commented on GitHub (Aug 9, 2015): Note, we 'might' be able to squeeze this logic into existing --make-charset but we may also need to add a supplement, and possibly even change the version of the chr file format for this. I would say current chr format version is kept for all <= 8 bit chr files (and john reads them in), but a new version is created for > 8bit chr files. It may simply be that we build 16bit chr files and 32bit chr files. Then when building them, simply convert the utf into proper 'character', and if all characters fit in 8 bit, we do an 8 bit file (this would include any 'code page' input), if all utf8 fit into 16 bits, we build a 16 bit format and if all fit into 32bit, we build a 32bit format. Then upon running it is simple again. Just an array of characters (like we have now), and whatever probability crap goes with them. It would just be that upon completion of the word, the inc code would have to convert from UTF16 into utf8 (if that is the encoding)
Author
Owner

@magnumripper commented on GitHub (Aug 9, 2015):

Note that any work with this should be in a topic branch until all initial problems are ironed out.

<!-- gh-comment-id:129243331 --> @magnumripper commented on GitHub (Aug 9, 2015): Note that any work with this should be in a topic branch until all initial problems are ironed out.
Author
Owner

@jfoug commented on GitHub (Aug 9, 2015):

I have started on nothing yet, but have been thinking about it, and yes you are right, this one will need to be worked on a bit, before trying to turn it loose. It will also likely take coordination with Solar, since inc is core stuff. If anything it should at least 'safely' expand upon what is in core part of inc.

I really think the inc stuff may be much easier (easier than rules at least). Simply convert into utf16, let mk-inc work like before, except keeping 16 bit values vs 8 bit values. Then when running, run it in 16 bit mode, building the permutations, but then do an enc into utf8 from the 16 bit buffer. It really should not be much more than that. We have to get that conversion to be as lightning fast as possible, because it is (or likely is) holding up the hot loop.

<!-- gh-comment-id:129243800 --> @jfoug commented on GitHub (Aug 9, 2015): I have started on nothing yet, but have been thinking about it, and yes you are right, this one will need to be worked on a bit, before trying to turn it loose. It will also likely take coordination with Solar, since inc is core stuff. If anything it should at least 'safely' expand upon what is in core part of inc. I really think the inc stuff may be much easier (easier than rules at least). Simply convert into utf16, let mk-inc work like before, except keeping 16 bit values vs 8 bit values. Then when running, run it in 16 bit mode, building the permutations, but then do an enc into utf8 from the 16 bit buffer. It really should not be much more than that. We have to get that conversion to be as lightning fast as possible, because it is (or likely is) holding up the hot loop.
Author
Owner

@magnumripper commented on GitHub (Aug 9, 2015):

As I wrote elsewhere, rules support is just as trivial. But wordlist.c has to go through the facelift too.

<!-- gh-comment-id:129256808 --> @magnumripper commented on GitHub (Aug 9, 2015): As I wrote elsewhere, rules support is just as trivial. But wordlist.c has to go through the facelift too.
Author
Owner

@magnumripper commented on GitHub (Aug 9, 2015):

See #1631 and discussion on ML: http://www.openwall.com/lists/john-dev/2015/08/09/4

<!-- gh-comment-id:129256852 --> @magnumripper commented on GitHub (Aug 9, 2015): See #1631 and discussion on ML: http://www.openwall.com/lists/john-dev/2015/08/09/4
Author
Owner

@frank-dittrich commented on GitHub (Aug 10, 2015):

May be don't change the .chr file version, but add the charsize as a second attribute, if that would allow john to run with chr files of char size 1 or 2 or 4.

<!-- gh-comment-id:129334828 --> @frank-dittrich commented on GitHub (Aug 10, 2015): May be don't change the .chr file version, but add the charsize as a second attribute, if that would allow john to run with chr files of char size 1 or 2 or 4.
Author
Owner

@magnumripper commented on GitHub (Aug 10, 2015):

params.h

#define CHARSET_MIN         0x01
#define CHARSET_MAX         0x10ffff
#define CHARSET_LENGTH          24

😄

<!-- gh-comment-id:129377491 --> @magnumripper commented on GitHub (Aug 10, 2015): params.h ``` #define CHARSET_MIN 0x01 #define CHARSET_MAX 0x10ffff #define CHARSET_LENGTH 24 ``` :smile:
Author
Owner

@frank-dittrich commented on GitHub (Aug 10, 2015):

CHARSET_LENGTH is the max. password length in bytes (which was 8 in older versions), no?

<!-- gh-comment-id:129426981 --> @frank-dittrich commented on GitHub (Aug 10, 2015): CHARSET_LENGTH is the max. password length in bytes (which was 8 in older versions), no?
Author
Owner

@jfoug commented on GitHub (Aug 10, 2015):

No, magnum is talking charset_max (I think)

<!-- gh-comment-id:129481044 --> @jfoug commented on GitHub (Aug 10, 2015): No, magnum is talking charset_max (I think)
Author
Owner

@magnumripper commented on GitHub (Aug 11, 2015):

I think for a 32-bit version, CHARSET_LENGTH will be the max. password length in characters.

<!-- gh-comment-id:129844013 --> @magnumripper commented on GitHub (Aug 11, 2015): I think for a 32-bit version, CHARSET_LENGTH will be the max. password length in _characters_.
Author
Owner

@magnumripper commented on GitHub (Nov 12, 2015):

Btw, incremental 'does' work in a limited subset for utf-8. It can handle 2 and 3 char utf8 pretty well, but it does not know anything about the encoding system. It simply works because of internal tri-glyph logic. So those 3 (or 2) bytes of utf-8 get seen as a very often used 3 (or 2) character substring and thus become very highly likely to be output. But that does not mean inc does utf-8.

I did some tests today. Trained with eg. the Rockyou list, incremental produces some good UTF-8 and very few bad candidates (with invalid UTF-8). However, if training with a Greek, Russian or Arabic wordlist, it gets a whole lot worse. Worst seen was 30% valid candidates and 70% garbage. I guess languages like Portugese (with plenty use of á à variants) come somewhere inbetween.

<!-- gh-comment-id:155955626 --> @magnumripper commented on GitHub (Nov 12, 2015): > Btw, incremental 'does' work in a limited subset for utf-8. It can handle 2 and 3 char utf8 pretty well, but it does not know anything about the encoding system. It simply works because of internal tri-glyph logic. So those 3 (or 2) bytes of utf-8 get seen as a very often used 3 (or 2) character substring and thus become very highly likely to be output. But that does not mean inc does utf-8. I did some tests today. Trained with eg. the Rockyou list, incremental produces some good UTF-8 and very few bad candidates (with invalid UTF-8). However, if training with a Greek, Russian or Arabic wordlist, it gets a whole lot worse. Worst seen was 30% valid candidates and 70% garbage. I guess languages like Portugese (with plenty use of á à variants) come somewhere inbetween.
Author
Owner

@magnumripper commented on GitHub (Dec 15, 2018):

See #3510

<!-- gh-comment-id:447573579 --> @magnumripper commented on GitHub (Dec 15, 2018): See #3510
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#1072
No description provided.