LM Implementation

Moderator: BarsMonster

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
LordMike
Posts: 184
Joined: Tue Feb 10, 2009 8:34 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

LM Implementation

Post by LordMike » Tue Feb 10, 2009 9:35 am

Description:
Name: LM - Lan Manager
Usage: Microsoft Windows NT logon users passwords over network / locally.

Note: LM can take a max of 7 digits. So the trick for longer passwords, is to concat two hashes.
Example:
Longpa (Len: 6 (Under 7)): Hash: LM("Longpa ") & LM("")
Longpass (Len: 8): Hash: LM("Longpas") & LM("s")

Pseudocode:
1. The user’s password as an OEM string is converted to uppercase.
2. This password is either null-padded or truncated to 14 bytes.
3. The “fixed-length” password is split into two 7-byte halves.
4. These values are used to create two DES keys, one from each 7-byte half, by converting the seven bytes into a bit stream, and inserting a zero bit after every seven bits. This generates the 64 bits needed for the DES key.
5. Each of these keys is used to DES-encrypt the constant ASCII string “KGS!@#$%”, resulting in two 8-byte ciphertext values.
6. These two ciphertext values are concatenated to form a 16-byte value, which is the LM hash.

From wikipedia.

Pseudo:

Code: Select all

// Prepare variables
// 1. The user’s password as an OEM string is converted to uppercase.
tUsername = UpperCase(Username)

// 2. This password is either null-padded or truncated to 14 bytes.
if (password.length > 14) { tPassword = left(password, 14) }
if (password.length < 14) { tPassword = pad(password, 14, NULL) }

// Split password
// 3. The “fixed-length” password is split into two 7-byte halves.
tPass1 = left(tPassword, 7)
tPass2 = right(tPassword, 7)

// Make DES keys
// 4. These values are used to create two DES keys, one from each 7-byte half, by converting the seven bytes into a bit stream, and inserting a zero bit after every seven bits. This generates the 64 bits needed for the DES key.

// For this, I've made an example, that illustrates the concept:
1111111111111111111111111111111111111111111111111111111111111111     // Wanted length, 64 [u](Purely example, to compare lengths)[/u]
11111111111111111111111111111111111111111111111111111111                   // Our password, length: 7 * 8: 56
1111111011111110111111101111111011111110111111101111111011111110     // Our new password, added a 0 after every 7 bits. Length: 64

// Encrypt "KGS!@#$%"
// 5. Each of these keys is used to DES-encrypt the constant ASCII string “KGS!@#$%”, resulting in two 8-byte ciphertext values.
tEnc1 = DES("KGS!@#$%", tKey1) // Result is 8 bytes
tEnc2 = DES("KGS!@#$%", tKey2) // Result is 8 bytes

// Concat / Result
// 6. These two ciphertext values are concatenated to form a 16-byte value, which is the LM hash.
tHash = tEnc1 + tEnc2

C Code:
Trying to make this. Will leave this empty so far.

Results:
"Test" -> 01FC5A6BE7BC6929
"Test2" -> E3FDADCB358C2967
"A" -> 7584248B8D2C9F9E
"Longpass" -> D171DE7EFF6A9F31
"Longpasss" -> D171DE7EFF6A9F31 (Note same hash).
"Longpass" (As done by MS): D171DE7EFF6A9F31 ("Longpas") & 93E28745B8BF4BA6 ("s")
Last edited by LordMike on Tue Feb 10, 2009 12:16 pm, edited 1 time in total.

Sc00bz
Posts: 136
Joined: Fri Oct 03, 2008 8:28 am
Contact:

Re: LM Implementation

Post by Sc00bz » Tue Feb 10, 2009 11:37 am

Here's LM and NTLM implemented in javascript http://funprogs.topcities.com/hashgen.htm

User avatar
LordMike
Posts: 184
Joined: Tue Feb 10, 2009 8:34 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LM Implementation

Post by LordMike » Tue Feb 10, 2009 2:08 pm

Thanks for that ;)

However I might need some help on the C code part. I'm not the best at C (Actually, I work on C# and other .Net stuff)...

Bitweasil
Posts: 110
Joined: Fri Nov 07, 2008 6:50 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LM Implementation

Post by Bitweasil » Tue Feb 10, 2009 5:37 pm

The tricky bit is in the function, DES() - that's not quite trivial to implement in CUDA yet.

User avatar
LordMike
Posts: 184
Joined: Tue Feb 10, 2009 8:34 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LM Implementation

Post by LordMike » Tue Feb 10, 2009 5:48 pm

I've read elsewhere about the problems. However, I haven't quite understood it yet.

Ah well, it'll probably be solved at some point.
Elcomsoft do it at 75M/s on GPU, LM.

mrb
Posts: 51
Joined: Sat Oct 18, 2008 6:04 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: LM Implementation

Post by mrb » Wed Feb 11, 2009 6:03 am

LordMike wrote: Ah well, it'll probably be solved at some point.
Elcomsoft do it at 75M/s on GPU, LM.
They claim 170 Mhash/s on the Tesla S1070 (same specs as GTX 280).

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest