Skip to content

CR91TQ94/KeePass_keyfile_generator

Repository files navigation

KeePass Python keyfile generator (memorable)

This script is a KeePass keyfile generator, which allows you to create a secure keyfile using a memorable brain-key.  KeePass is a widely-used password manager that enhances security by requiring a keyfile in addition to a master password.  These scripts take a user-provided brain-key, compute a hash, and then processes this hash to create a SHA-256 hash.  The result is formatted into an XML document that serves as the KeePass keyfile.

Three types of hashing:

These scripts offer three distinct methods for processing your brain-key: standard SHA-256, Keccak-512, and SHAKE-256 with a variable output length.  You may select the type that best suits your needs.  The SHAKE algorithm provides the flexibility to choose the output length according to your preference.

How It Works:

  1. Brain-Key Input: The script takes a memorable brain-key input (e.g., "password").
  2. Three hashing types: It calculates the hash of the input and stores it as SHA-2 (256), or Keccak (512), or Shake (256/variable)
  • a) SHA2_KeePass_keyfile.py: It calculates the SHA-2/256 hash of the input and stores it.
  • b) KECCAK_KeePass_keyfile.py: It calculates the Keccak/512 hash of the input and stores it.
  • c) SHAKE_KeePass_keyfile.py: It calculates the SHAKE(-256) hash of the input with a free output length (example of 111 / 222 hex) and stores it.
  1. Raw Conversion: The hash is converted from HEX to raw bytes.
  2. SHA-256 Hash: The script then computes the SHA-256 hash of the raw bytes and extracts the first 8 characters.
  3. XML Keyfile Creation: An XML document is generated, embedding both hashes, and saved as a *.keyx file.

Security Warning:

Using this method to generate KeePass keyfiles can be very dangerous if not used properly.  The security of your keyfile relies heavily on the secrecy and strength of your brain-key.  If the brain-key is weak or easily guessable, it could lead to someone breaking your keys and gaining unauthorized access to your KeePass database.  Always use a strong, unique brain-key and handle the generated keyfile with extreme caution.


The script is designed to make it easy to create a secure keyfile for KeePass, but it must be used responsibly to ensure your data remains protected.

About

Python keyfile generator (memorable)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages