[jcifs] Compute password hashes

Volker Jordan jordan at ffm-one.com
Thu Nov 5 03:46:38 MST 2009


Am Mittwoch, den 04.11.2009, 13:27 -0600 schrieb Christopher R. Hertel:
> The explanation of how these algorithms work can be found in the following
> locations:
> 
>   LM Challenge/Response: http://www.ubiqx.org/cifs/SMB.html#SMB.8.3
> NTLM Challenge/Response: http://www.ubiqx.org/cifs/SMB.html#SMB.8.4
> 
> There is some example C code here:
>   http://www.ubiqx.org/libcifs/source/Auth/
> ...but it doesn't provide the actual program you'd need in order to generate
> the hashes (mostly because that step is exceedingly simple once you know how
> it works).
> 
> Chris -)-----
> 
Ok, I got the MD4 hash running, but DES still does not work.

Can you help me with java ?

Here is my code:

String magicKey="KGS!@#$%";
String password="1234567";
byte[] passwordByte17=password.getBytes("windows-1252");
SecretKeyFactory desKeyFac=SecretKeyFactory.getInstance("DES");
SecretKey desKey=desKeyFac.generateSecret(new
DESKeySpec(magicKey.getBytes("windows-1252")));
desCipher = Cipher.getInstance("DES");
desCipher.init(Cipher.ENCRYPT_MODE, desKey);
byte[] desHash=desCipher.doFinal(passwordByte17);

The final desHash is not the same comparing to what a smbpasswd
generates.

What is wrong ?

Volker 



More information about the jCIFS mailing list