Description Usage Arguments Details Examples
The function uses a random Wikipedia page to generate a portmanteau password, as in the XKCD comic https://m.xkcd.com/936/ .
1 2 |
pw.len |
Number of words to use in the password. Default is 4, as in the comic. |
min.len |
Minimum word length for each word in the portmanteau. |
max.len |
Maximum word length for each word in the portmanteau. |
language |
The language the resulting password will be in. |
... |
Extra arguments. |
num.scrapes |
The number of Wikipedia scrapes to perform for a single password generation. Must be between 1 and 5. |
ret.type |
Controls the format of the returned password; options are "separate" or "combined", with the former being the default. |
The function password()
forms a portmanteau password, inspired
by XKCD comic number 936. Rather than using a dictionary, however,
we use a random Wikipedia page as our word source.
By default, the password will be a portmanteau made up of 4 words
randomly selected from a random Wikipedia page. You may change this
number to another (sensible) choice via the argument pw.len=
.
The arguments min.len=
and max.len=
refer to the length
of each word in the portmanteau, rather than the length of the final
password.
The language=
argument specifies which Wikipedia pages will be
scraped. Currently, options are:
english
for English
french
, francais
, or fran
for French
german
or deutsch
for German
italian
or italiano
for Italian
polish
or polski
for Polish
portugese
or p
for Portugese
russian
or for Russian
spanish
, espanol
, or espa
for Spanish
This argument is case-insensitive.
The optional argument num.scrapes=
determines the number of
Wikipedia pages to scrape for a given password generation. The
default is 1, which should be fine almost every time; if not, make
sure min.len=
isn't set to something stupid and try again.
Note that num.scrapes=
is limited to a maximum of 5; much
more than that really should not improve the password, and it just
needlessly hammers Wikipedia (which might get your ip banned). It
would also really slow the scrubbing to a crawl.
Finally, it should be noted that the function requires an internet connection, as a new, random Wikipedia page is scraped each time the function is evaluated.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.