Return a random text string, in hexadecimal. The string has *nbytes* random bytes, each byte converted to two hex digits. If *nbytes* is ``None`` or not supplied, a reasonable default is used. >>> token_hex(16) #doctest:+SKIP 'f9bf78b9a18ce6d46a0cd2b0b86df9da'
(nbytes=None)
| 45 | return _sysrand.randbytes(nbytes) |
| 46 | |
| 47 | def token_hex(nbytes=None): |
| 48 | """Return a random text string, in hexadecimal. |
| 49 | |
| 50 | The string has *nbytes* random bytes, each byte converted to two |
| 51 | hex digits. If *nbytes* is ``None`` or not supplied, a reasonable |
| 52 | default is used. |
| 53 | |
| 54 | >>> token_hex(16) #doctest:+SKIP |
| 55 | 'f9bf78b9a18ce6d46a0cd2b0b86df9da' |
| 56 | |
| 57 | """ |
| 58 | return token_bytes(nbytes).hex() |
| 59 | |
| 60 | def token_urlsafe(nbytes=None): |
| 61 | """Return a random URL-safe text string, in Base64 encoding. |
nothing calls this directly
no test coverage detected
searching dependent graphs…