BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

diceware.php 702B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. # Load the dictionary
  3. require_once 'wordlist.php';
  4. # Get $x secure d6 integers
  5. function roll_dice($x)
  6. {
  7. $y = '';
  8. for ($i = 0; $i < $x; $i++) {
  9. $y .= random_int(1, 6);
  10. }
  11. return (int) $y;
  12. }
  13. function get_words($x, $wl)
  14. {
  15. $dice = [];
  16. $pw = '';
  17. # How many times to roll?
  18. foreach (range(1, $x) as $i) {
  19. array_push($dice, roll_dice($x));
  20. }
  21. # Concatenate wordlist entries
  22. foreach ($dice as $die) {
  23. $pw .= ucfirst($wl[$die]);
  24. #$pw .= $wl[$die] . ' ';
  25. }
  26. return trim($pw);
  27. }
  28. # Vomit a passphrase
  29. echo get_words(5, $eff_large_wordlist);
  30. echo get_words(5, $eff_large_wordlist);
  31. echo get_words(5, $eff_large_wordlist);