PKI.genpass {PKI} | R Documentation |
Generate cryptographically strong pseudo-random password.
Description
PKI.genpass
generates n
cryptographically strong
pseudo-random password by using a given set of allowed characters.
Usage
PKI.genpass(n=15, set=c(alphanum, ".", "/"), block=5, sep="-")
Arguments
n |
positive integer, number of random elements in the password |
set |
character vector, set of characters to use in the
password, ideally its length should be a power of 2 and must be at
most 256. Internal variable |
block |
non-negative integer, number of character blocks in the password or 0 if no separated blocks are desired. |
sep |
string, separator between blocks (only used if 0 <
|
Details
PKI.genpass
generates a password based on a set of allowable
characters by subsetting the set with bytes generated using
PKI.random
.
If block
is >0 and <n
then blocks of block
characters are separated by the separator string sep
. This is
typically used to guarantee at least one special character in the
password. The default results in a 90-bit random password of the form
XXXXX-XXXXX-XXXXX
.
Value
String, generated password.
Note
This is just a utility front-end to PKI.random(n)
to
subset set
modulo its length. If the set does not have a length
which is a power of 2 then a warning is issued and the leading
elements are more likely to be used, reducing the password strength.
Author(s)
Simon Urbanek
Examples
PKI.genpass()