Diceware is a Python library and command-line tool for generating secure, memorable passphrases using the Diceware method. It generates passphrases by concatenating words randomly picked from wordlists. The library supports various sources of randomness, including Python's `SystemRandom` by default, and allows for different wordlists, including the EFF wordlist. It also offers options for capitalization and special characters. The current version is 1.0.1, actively maintained with recent updates.
pip install dicewareVerified import paths — ran on the pinned version, not inferred.
Generate a Diceware passphrase using the `get_passphrase` function by providing an `options` object that mimics `argparse.Namespace`. The example uses default settings for a 6-word passphrase with capitalized words and no special characters or delimiters, leveraging the EFF wordlist and `SystemRandom`.
For maximum security, consider generating passphrases using actual physical dice in combination with the Diceware wordlists, rather than relying solely on computer-generated randomness. The library provides a `RealDiceRandomSource` option for integration.
To mitigate reduced entropy, prioritize using wordlists with entries that are a perfect power of the dice sides, or choose longer passphrases.
When using custom wordlists, ensure they do not contain words that are prefixes of other words in the list to maintain maximum entropy.
If disabling capitalization, it is recommended to use a clear delimiter between words (e.g., a space) to preserve entropy and readability.
It is highly recommended to use Python 3.x (preferably 3.7+) for all new development and security-sensitive applications.
Ensure the path to your custom wordlist file is correct and the file exists. If you intended to use a built-in wordlist, remove the `--infile` option.
Instead of importing internal modules, use the public API by importing the top-level `diceware` module and accessing its functions, for example, `from diceware import get_passphrase`.
This warning is usually addressed by the library maintainers in newer versions. As a user, you can often safely ignore this warning as it typically does not prevent the program from functioning, or update to the latest `diceware` version if a fix has been released.