Lines Matching refs:nbytes
34 def token_bytes(nbytes=None):
35 """Return a random byte string containing *nbytes* bytes.
37 If *nbytes* is ``None`` or not supplied, a reasonable
44 if nbytes is None:
45 nbytes = DEFAULT_ENTROPY
46 return _sysrand.randbytes(nbytes)
48 def token_hex(nbytes=None):
51 The string has *nbytes* random bytes, each byte converted to two
52 hex digits. If *nbytes* is ``None`` or not supplied, a reasonable
59 return binascii.hexlify(token_bytes(nbytes)).decode('ascii')
61 def token_urlsafe(nbytes=None):
64 The string has *nbytes* random bytes. If *nbytes* is ``None``
71 tok = token_bytes(nbytes)