Skip to content

Commit

Permalink
Possibility to use modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
kduma committed Jan 31, 2018
1 parent 80b924e commit 8e1e50d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/PassphraseGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class PassphraseGenerator
*/
protected $diceware = true;

/**
* @var bool If true no words are capitalized or changed to lower case (words are not modified)
*/
protected $modifiers = false;

/**
* @var int entropy used to generate passphrase (must be between 26.0 and 120.0 bits)
*/
Expand Down Expand Up @@ -46,6 +51,28 @@ public function useEnglishWordList(): PassphraseGenerator
return $this;
}

/**
* Don't use modifiers
*
* @return PassphraseGenerator
*/
public function dontUseModifiers(): PassphraseGenerator
{
$this->modifiers = true;
return $this;
}

/**
* Use modifiers
*
* @return PassphraseGenerator
*/
public function useModifiers(): PassphraseGenerator
{
$this->modifiers = false;
return $this;
}

/**
* set amount of entropy
*
Expand Down Expand Up @@ -84,6 +111,7 @@ public function get(): string
$gen->addWordlist('diceware.lst', 'diceware');
}

$gen->disableWordModifier($this->modifiers);
$gen->alwaysUseSeparators(true);
$gen->setSeparators($this->separators);

Expand Down

0 comments on commit 8e1e50d

Please sign in to comment.