The LM hash is computed as follows:[1][2] 1. The user’s ASCII password is converted to uppercase. 2. This password is null-padded to 14 bytes.[Notes 1][3] 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 null bit after every seven bits (so 1010100 becomes 01010100). 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. The DES CipherMode should Set to ECB, and PaddingMode should set to NONE. 6. These two ciphertext values are concatenated to form a 16-byte value, which is the LM hash. |
|
|
DES-Example.cpp: In function ‘int main()’: DES-Example.cpp:64: warning: cannot pass objects of non-POD type ‘struct std::string’ through ‘...’; call will abort at runtime DES-Example.cpp:64: warning: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int’ DES-Example.cpp:65: error: cannot convert ‘std::string’ to ‘char*’ for argument ‘2’ to ‘char* Encrypt(char*, char*, int)’ DES-Example.cpp:66: warning: cannot pass objects of non-POD type ‘struct std::string’ through ‘...’; call will abort at runtime DES-Example.cpp:66: warning: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int’ DES-Example.cpp:68: warning: cannot pass objects of non-POD type ‘struct std::string’ through ‘...’; call will abort at runtime DES-Example.cpp:68: warning: format ‘%s’ expects type ‘char*’, but argument 2 has type ‘int’ DES-Example.cpp:69: error: cannot convert ‘std::string’ to ‘char*’ for argument ‘2’ to ‘char* Encrypt(char*, char*, int)’ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DES-Example.cpp:65: error: invalid conversion from ‘const char*’ to ‘char*’ DES-Example.cpp:65: error: initializing argument 2 of ‘char* Encrypt(char*, char*, int)’ |