Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParityAdjust ¶
ParityAdjust takes a byte slice as input and adjusts it for DES key parity. For each 7 bits of the input, it adds a parity bit as the 8th bit to ensure odd parity (each byte has an odd number of 1 bits). This is required for DES key generation in NTLM authentication.
The function processes the input in 7-bit chunks, adding a parity bit to each chunk to form 8-bit bytes in the output. If the input length is not a multiple of 7 bits, it pads with zeros.
Returns the parity-adjusted byte slice and any error encountered during processing.
Types ¶
type NTLMv1 ¶
type NTLMv1 struct {
Username string
Password string
Domain string
ServerChallenge []byte
NTHash []byte
}
NTLMv1 represents the components needed for NTLMv1 authentication
func NewNTLMv1WithNTHash ¶
func NewNTLMv1WithNTHash(domain, username string, nthash []byte, serverChallenge []byte) (*NTLMv1, error)
NewNTLMv1WithNTHash creates a new NTLMv1 instance with the provided credentials and challenge
func NewNTLMv1WithPassword ¶
func NewNTLMv1WithPassword(domain, username, password string, serverChallenge []byte) (*NTLMv1, error)
NewNTLMv1WithPassword creates a new NTLMv1 instance with the provided credentials and challenge
func (*NTLMv1) Hash ¶
NTLMv1Hash calculates the NTLMv1 hash
Returns:
- The NTLMv1 hash as a byte slice
- An error if the NTHash or Password is not set
func (*NTLMv1) LMResponse ¶
LMResponse calculates the LM response for NTLMv1 authentication
The LM response is calculated by first creating the LM hash from the password, then encrypting the server challenge with the LM hash using DES encryption. The LM hash is split into three 7-byte keys, each adjusted for DES parity, and each key is used to encrypt the challenge.
Returns the 24-byte LM response or an error if the encryption fails.
func (*NTLMv1) NTResponse ¶
NTResponse calculates the NT response for NTLMv1 authentication
The NT response is calculated by encrypting the server challenge with the NT hash using DES encryption. The NT hash is split into three 7-byte keys, each adjusted for DES parity, and each key is used to encrypt the challenge.
Returns the 24-byte NT response or an error if the encryption fails.