Generate a secure password using any file and a password key.
Enter file name: Example.png
Enter a password key: test
Confirm password key: test
Generated Password: fUux)J4Hz9&R3CG7iiLk
Press enter to copy and close...
- Make sure you have everything required to run the script (see below).
- Run the script.
- Enter the name and extension of a file in the same folder as the script (eg.
Example.png). - Enter a password key (eg.
MyPassword123). Your input will be hidden when typing. - Verify the password by entering it again, or skip this step by pressing enter.
- You will now see the generated password unless you run the script with
-Hor--hidden. Press enter to copy it to your clipboard and close the program.
- Python 3.6+
cryptographypackage (pip install -r requirements.txt)
This Python script generates a strong password using a file and a password key. The output of the program can not be decrypted and will always be the same if the input is the same, any small change will give a completely different result. The generated password should always pass the requirements for any site.
-
File Selection: When running the program, you will be prompted to enter the name of a file. The file must be in the same folder as the script, and you need to include the name and extension of the file (eg.
Example.png). Any file type should work. -
Password Key: After selecting a valid file, you will be prompted to enter a password key. You can enter any text here (eg.
MyPassword123). It is important that you remember the key, as it will be used to generate the password. -
Password Confirmation: You will be asked to confirm your password key. You can re-enter it or just press enter to skip the confirmation step. It is recommended to retype the password when creating it for the first time.
-
Password Generation: Your file is hashed using SHA-256, and part of that file hash is used as the salt for PBKDF2. Your password key is then passed through PBKDF2-HMAC-SHA256 to produce deterministic bytes. Those bytes are mapped directly to allowed password characters, ensuring the final password is valid anywhere. The characters are then shuffled deterministically, so the same file and password key always produce the same 20-character password.
-
Copying the Password: Once the password is generated, you can either manually copy it or press enter to automatically copy it to your clipboard and close the script. If you start the program with
-Hor--hidden, the displayed password will be masked while the real password is still copied to the clipboard. -
Reusing the Password: The output password you get from the program will always be the same if your file data and password key are EXACTLY the same, any change to the file content (name excluded) or the key will give you a completely different password.
You are free to use the project however you want, I don't care. Credit would be appreciated if you use it for something tho.