Table of Contents
1. Introduction
Persistent reports of website account and password leaks highlight the critical importance of information and password security. While website vulnerabilities are a factor, the inherent security of the password itself is paramount. Common insecure password practices include keyword-based passwords, popular phrase usage, incorporation of personal information, and password reuse. The rise of AI and large language models further empowers attackers to guess passwords more effectively.
This research proposes a secure password generator based on cryptographically secure Pseudo-Random Number Generators (PRNGs). It constructs PRNGs using Keyed-Hash Message Authentication Code (HMAC), Cipher-based MAC (CMAC), or KECCAK MAC (KMAC) to generate secure random numbers, which are then used to produce passwords. The generated randomness is validated against the NIST SP 800-90B standard through entropy and Independent and Identically Distributed (IID) tests.
2. Literature Review
2.1. Linear Congruential Generator-based PRNG
Commonly used in languages like C and Java, LCGs generate a sequence via the recurrence relation: $f_i(k) \equiv a \times f_{i-1}(k) + c \ (\text{mod} \ m)$, seeded by $k$. They are insecure as the state can be reversed: $f_{i-1}(k) \equiv (f_i(k) - c) \times a^{-1} \ (\text{mod} \ m)$, exposing the seed and entire sequence.
2.2. Secure Pseudo-Random Number Generators
Cryptographic PRNGs are designed to be unpredictable, even when partial output is known.
2.2.1. HMAC-based PRNG
Security relies on the one-way property of hash functions (e.g., SHA2, SHA3). For a key $k$ and message $M$, the HMAC is computed as: $r_{hmac}(k, M) = h((k \oplus opad) \ || \ h((k \oplus ipad) \ || \ M))$. Counter mode is used to generate multiple blocks for longer outputs.
2.2.2. CMAC-based PRNG
Security is based on the Advanced Encryption Standard (AES). It operates in Cipher Block Chaining (CBC) mode. The final ciphertext block after processing the padded message serves as the MAC/output: $r_{cmac}(k, Split(M))$.
2.2.3. KMAC-based PRNG
Based on the SHA-3 (KECCAK) hash function, KMAC provides a variable-length output and is considered a strong candidate for post-quantum cryptography.
2.3. Randomness Validation Methods
NIST SP 800-90B provides methodologies for assessing entropy sources. Entropy estimation quantifies the unpredictability (min-entropy). IID testing checks if the data is independent and identically distributed, a key assumption for many statistical tests. Passing these validates the quality of the randomness source.
3. Proposed Secure Password Generator
The system architecture involves: 1) User optionally provides a To-Be-Hashed Message (TBHM). 2) A cryptographic PRNG (HMAC/CMAC/KMAC-based) uses the TBHM (and a key) to generate a high-entropy bitstream. 3) This bitstream is mapped onto a user-defined character set (e.g., alphanumeric + symbols) of a specified length to produce the final password. The security is analyzed by comparing the password's search space against AES-128 and AES-256 key strengths.
4. Experiments and Results
4.1. Experimental Setup
Implemented the three PRNG types (HMAC-SHA256, CMAC-AES-128, KMAC256). Generated large sequences of random bits for testing.
4.2. Randomness Validation Results
Key Result: All three proposed PRNG constructions (HMAC, CMAC, KMAC) successfully passed both the entropy validation and IID tests as per NIST SP 800-90B. This empirically demonstrates that the generated numbers possess sufficient randomness and statistical quality for cryptographic password generation.
4.3. Performance Analysis
Computational efficiency was evaluated. While all methods are viable, KMAC and HMAC may show different performance profiles depending on the platform, with AES-based CMAC often being faster on hardware with AES acceleration.
5. Conclusion and Future Work
This paper presented a secure password generator framework built on cryptographic PRNGs (HMAC, CMAC, KMAC). The generated randomness was validated using NIST standards, confirming its suitability. Future work includes integrating the generator into browser extensions or password managers, exploring its use in generating cryptographic keys beyond passwords, and testing resilience against emerging AI-based guessing attacks.
6. Original Analysis & Expert Commentary
Core Insight: This paper isn't about inventing a new cipher; it's a pragmatic, standards-compliant engineering solution to a pervasive human problem: weak password creation. Its core value lies in correctly applying established cryptographic primitives (HMAC, CMAC, KMAC) as NIST-recommended PRNGs and rigorously validating the output—a step often glossed over in "DIY" password generators. In an era where AI can model personal data patterns (as seen in research on AI-powered password guessing like PassGAN), shifting the source of password randomness from human brains to validated cryptographic algorithms is a non-negotiable security upgrade.
Logical Flow: The logic is sound and follows a classic applied cryptography template: 1) Identify vulnerability (weak human-generated passwords). 2) Select appropriate, vetted cryptographic tools (NIST SP 800-108 PRNGs). 3) Construct a system (map PRNG output to character set). 4) Validate the core component (PRNG output via NIST SP 800-90B). This methodology mirrors best practices in secure system design, similar to how modern libraries like `libsodium` prioritize robust, default-secure primitives.
Strengths & Flaws:
Strengths: The rigorous NIST validation is the paper's strongest suit, providing empirical credibility. The use of KMAC aligns with post-quantum preparedness. The optional user-input (TBHM) is a clever feature, allowing for deterministic password regeneration if needed, without compromising security if the PRNG is robust.
Flaws: The paper's primary limitation is its scope as a proof-of-concept. It lacks a real-world implementation analysis addressing side-channels (timing attacks during mapping), secure key management for the PRNG, and integration challenges with existing password policies. Furthermore, while it compares password strength to AES, it doesn't deeply analyze the entropy loss during the character set mapping process, which is a critical detail for short passwords.
Actionable Insights: For security practitioners, the takeaway is clear: Stop letting users or naive random functions choose passwords. Implement a backend password generator like this one for "forgot password" resets or initial user setup. The specific choice of PRNG can be tailored: use CMAC-AES for speed on common servers, KMAC for long-term quantum concern. Crucially, any adoption must include managing the PRNG's seed/key with the same rigor as any cryptographic key. This work should be integrated into frameworks like OWASP's Authentication Cheat Sheet as a recommended pattern for secure password generation.
7. Technical Details & Mathematical Formulation
The security hinges on the PRNG formulations. For HMAC:
$r_{hmac}(k, M) = h((k \oplus opad) \ || \ h((k \oplus ipad) \ || \ M))$
where $h$ is a hash like SHA-256, $ipad/opad$ are constants, and $k$ is the key. For password generation, a counter $i$ is incorporated into $M_i$ to generate multiple blocks: $M_i = i || \text{Label} || 0x00 || \text{Context} || L$. The output bits are then converted to an integer index to select characters from the set $C$ of size $N$: $\text{index} = \text{random_bits} \mod N$.
8. Analysis Framework & Case Example
Scenario: A web service needs to generate a strong 12-character password for a new user account.
Framework Application:
1. Define Parameters: Character set $C$ = 94 printable ASCII chars. Length $L=12$. PRNG choice: HMAC-SHA256.
2. Generate Randomness: Collect entropy for seed $k$. Use TBHM = "serviceX_user123". Run HMAC-based PRNG in counter mode to produce $\lceil log_2(94^{12}) \rceil \approx 79$ bits of entropy.
3. Map to Password: Use the 79-bit stream to generate 12 indices, each selecting a character from $C$.
4. Validation Check: The generated password's entropy is ~78.5 bits, comparable to an ~80-bit symmetric key, significantly stronger than any human-chosen password.
No-Code Workflow: This process can be encapsulated in a server-side API call, completely abstracting the cryptography from the end-user.
9. Future Applications & Directions
1. Password Manager Core Engine: Integrate this generator as the default password creation engine in open-source and commercial password managers (e.g., Bitwarden, 1Password).
2. Post-Quantum Transition: KMAC-based generation is a ready-made solution for quantum-resistant password and token generation, as recommended by the NIST Post-Quantum Cryptography project.
3. IoT & Embedded Security: Lightweight CMAC-AES versions can generate unique device passwords and API keys in constrained environments.
4. Blockchain & Web3: Generate secure, random mnemonic phrase seeds for cryptocurrency wallets using a verifiably random source.
5. Standardization: Propose this methodology to standards bodies like IETF or FIDO for inclusion in next-generation authentication protocols.
10. References
- M. Bishop, "Computer Security: Art and Science", Addison-Wesley, 2018.
- NIST, "Special Publication 800-63B: Digital Identity Guidelines", 2017.
- M. L. Mazurek et al., "Measuring Password Guessability for an Entire University", IEEE S&P, 2013.
- B. Ur et al., "How Does Your Password Measure Up? The Effect of Strength Meters on Password Creation", USENIX Security, 2012.
- NIST, "Special Publication 800-108: Recommendation for Key Derivation Using Pseudorandom Functions", Rev. 1, 2022.
- NIST, "Special Publication 800-90B: Recommendation for the Entropy Sources Used for Random Bit Generation", 2018.
- J. Kelsey, B. Schneier, D. Wagner, "Secure Applications of Low-Entropy Keys", ISW, 1997.
- FIPS PUB 202, "SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions", 2015.
- B. Hitaj et al., "PassGAN: A Deep Learning Approach for Password Guessing", NeurIPS Workshop, 2017.
- D. J. Bernstein et al., "The Security Impact of a New Cryptographic Random Number Generator", 2020.