A Rust implementation of NTLM and NetNTLMv2 hashing for password security analysis and authentication testing.
n2hash provides efficient and secure implementations of NTLM and NetNTLMv2 hashing algorithms used in Windows authentication systems. This library allows security researchers, penetration testers, and system administrators to work with these authentication protocols for legitimate security testing and analysis.
- NTLM Hash Generation: Fast computation of NTLM hashes (MD4 of UTF-16LE encoded passwords)
- NetNTLMv2 Hash Generation: Complete implementation of the NTLMv2 challenge-response protocol
- Pure Rust Implementation: Fully implemented in Rust with minimal dependencies
- RFC Compliant: Follows MS-NLMP protocol specifications
- Custom HMAC-MD5: Includes an efficient custom implementation of HMAC-MD5 based on RFC 2104
The project includes a Makefile that simplifies installation:
# Build the project
make build
# Install to user's local bin (~/.local/bin)
make install
# Install system-wide (requires sudo)
make install-system
# Uninstall from local bin
make uninstall
# Uninstall from system-wide location
make uninstall-system
# Build the project
cargo build --release
# The binary will be available at
# target/release/n2hash
The tool provides two main functions:
- NTLM Hash: Generate an NTLM hash from a password
- NetNTLMv2 Hash: Generate a NetNTLMv2 hash with username, domain, and password
Basic command syntax:
n2hash ntlm <password>
n2hash netntlmv2 <username> <domain> <password>
The NTLM hash is calculated as the MD4 hash of the UTF-16LE encoded password.
NetNTLMv2 involves:
- NTLM hash of password
- NTLMv2 key generation using HMAC-MD5
- Blob structure with version, timestamp, and challenge data
- NTProofStr calculation using HMAC-MD5
The output format is: username::domain:server_challenge:nt_proof_string:blob
This tool is intended for legitimate security testing, password migration, and educational purposes only. Always ensure you have proper authorization before using in any environment.
This project is licensed under the MIT License - see the LICENSE file for details.
Copyleft 2025 copyleftdev