def generate_password(size=10, charset=_52charset):
"""generate random password using given length & charset
:param size:
size of password.
:param charset:
optional string specified set of characters to draw from.
the default charset contains all normal alphanumeric characters,
except for the characters ``1IiLl0OoS5``, which were omitted
due to their visual similarity.
:returns: :class:`!str` containing randomly generated password.
.. note::
Using the default character set, on a OS with :class:`!SystemRandom` support,
this function should generate passwords with 5.7 bits of entropy per character.
"""
return getrandstr(rng, charset, size)
#=============================================================================
# object type / interface tests
#=============================================================================
评论列表
文章目录