uuid.uuid4() is not random enough for a nonce (sasl.scram)
This commit is contained in:
parent
67252833c4
commit
bffd43648d
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
import base64, enum, hashlib, hmac, typing, uuid
|
import base64, enum, hashlib, hmac, os, typing
|
||||||
|
|
||||||
def _scram_nonce() -> bytes:
|
def _scram_nonce() -> bytes:
|
||||||
return uuid.uuid4().hex.encode("utf8")
|
return base64.b64encode(os.urandom(32))
|
||||||
def _scram_escape(s: bytes) -> bytes:
|
def _scram_escape(s: bytes) -> bytes:
|
||||||
return s.replace(b"=", b"=3D").replace(b",", b"=2C")
|
return s.replace(b"=", b"=3D").replace(b",", b"=2C")
|
||||||
def _scram_unescape(s: bytes) -> bytes:
|
def _scram_unescape(s: bytes) -> bytes:
|
||||||
|
|
Loading…
Reference in a new issue