Skip to content

Commit

Permalink
Remove randbytes for 3.7 compatibility. sigh
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Sep 28, 2023
1 parent a482de5 commit 119857b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pubnub/crypto_core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import hashlib
import json
import random
import os

from abc import abstractmethod
from Cryptodome.Cipher import AES
Expand Down Expand Up @@ -131,7 +132,7 @@ def __init__(self, cipher_key):
self.cipher_key = cipher_key

def get_initialization_vector(self) -> bytes:
return random.randbytes(16)
return os.urandom(16)

def get_secret(self, key) -> str:
return hashlib.sha256(key.encode("utf-8")).digest()
Expand Down

0 comments on commit 119857b

Please sign in to comment.