File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -9,18 +9,11 @@ import base64
9
9
import hashlib
10
10
import hmac
11
11
import re
12
+ import secrets
12
13
import stringprep
13
14
import unicodedata
14
15
15
16
16
- # try to import the secrets library from Python 3.6+ for the
17
- # cryptographic token generator for generating nonces as part of SCRAM
18
- # Otherwise fall back on os.urandom
19
- try :
20
- from secrets import token_bytes as generate_token_bytes
21
- except ImportError :
22
- from os import urandom as generate_token_bytes
23
-
24
17
@cython.final
25
18
cdef class SCRAMAuthentication:
26
19
""" Contains the protocol for generating and a SCRAM hashed password.
@@ -198,7 +191,7 @@ cdef class SCRAMAuthentication:
198
191
cdef:
199
192
bytes token
200
193
201
- token = generate_token_bytes (num_bytes)
194
+ token = secrets.token_bytes (num_bytes)
202
195
203
196
return base64.b64encode(token)
204
197
You can’t perform that action at this time.
0 commit comments