Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 20 Jul 2011 16:25:57 -0500
From: "jfoug" <jfoug@....net>
To: <john-users@...ts.openwall.com>
Subject: RE: md5_gen format and sha1

>-----Original Message-----
>From: jm@...izoku.org [mailto:jm@...izoku.org] On Behalf Of Jean-Michel
>
>But the last format I want to add is SHA-1($p), having $p encoded in
>UTF-16LE format.
>
>I tried this in the configuration file, but the test failed :
>Flag=MGF_KEYS_UNICODE_B4_CRYPT
>Flag=MGF_SHA1_40_BYTE_FINISH
>Func=MD5GenBaseFunc__clean_input
>Func=MD5GenBaseFunc__append_keys
>Func=MD5GenBaseFunc__SHA1_crypt_input1_to_output1_FINAL

Try this one:

####################################################################
# sha1(UTF16LE($p))  NOTE, only works for iso-8859-1 -> Unicode
####################################################################
[List.Generic:md5_gen(1101)]
Expression=sha1(unicode($p))
Flag=MGF_SHA1_40_BYTE_FINISH
#Flag=MGF_NOTSSE2Safe
Func=MD5GenBaseFunc__clean_input
Func=MD5GenBaseFunc__setmode_unicode
Func=MD5GenBaseFunc__append_keys
Func=MD5GenBaseFunc__SHA1_crypt_input1_to_output1_FINAL
Test=md5_gen(1101)87f8ed9157125ffc4da9e06a7b8011ad80a53fe1:test
Test=md5_gen(1101)28f69840b617ece11b24fcb4bd380f6aa4569d60:thatsworking
Test=md5_gen(1101)ab7a9c43394b8631a2947e064efeb19a48c5ed89:test3


The MGF_KEYS_UNICODE_B4_CRYPT only works for other 'pre' processing flags,
such as:

#define MGF_KEYS_BASE16_IN1              0x0004
#define MGF_KEYS_BASE16_IN1_Offset32     0x0008
#define MGF_KEYS_BASE16_X86_IN1          0x0010
#define MGF_KEYS_BASE16_X86_IN1_Offset32 0x0020

In those cases, these string ops are outside of the control of the script
writer, they are done once, on the 'first' salt for the passwords.  The only
way I had to inform the script that those loadings should be done, was by
making another flag listing that when the keys are loaded, they should get
Unicode convert.  I also had to add a flag for the salt, but that is so that
the "MGF_SALT_AS_HEX" flag could be used with Unicode.


For normal running within the format, you have to turn on Unicode processing
(or turn it off again). To do that, simply add the
MD5GenBaseFunc__setmode_unicode() function, or to turn it back off, use the
MD5GenBaseFunc__setmode_normal() function.   These on/off functions are
super fast (simply set an integer variable to 1 or 0).  They do not do any
string conversions.  What happens, is WHEN the next function (the
MD5GenBaseFunc__append_keys function), is called, the string(s) that are
loaded will have unicode conversion performed, vs simply being copied just
like they originally are.

NOTE, that if you are running this on a SSE-x64 build, I am pretty sure you
will have to uncomment the Flag=MGF_NOTSSE2Safe. I have no way of testing on
linux-64 right now, but I am 95% sure you will have to set that flag.


Jim.

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.