Skip to content

Commit

Permalink
Fix compatibility with py3.7... again
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Sep 28, 2023
1 parent 786151d commit a482de5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pubnub/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def encode_header(self, cryptor_ver=None, cryptor_id: str = None, cryptor_data:
cryptor_id = self._validate_cryptor_id(cryptor_id)
cryptor_ver = cryptor_ver or self.CRYPTOR_VERSION
sentinel = b'PNED'
version = cryptor_ver.to_bytes()
version = cryptor_ver.to_bytes(1, byteorder='big')
crid = bytes(cryptor_id, 'utf-8')

if cryptor_data:
Expand All @@ -220,9 +220,9 @@ def encode_header(self, cryptor_ver=None, cryptor_id: str = None, cryptor_data:
cryptor_data_len = 0

if cryptor_data_len < 255:
crlen = cryptor_data_len.to_bytes(1)
crlen = cryptor_data_len.to_bytes(1, byteorder='big')
else:
crlen = b'\xff' + cryptor_data_len.to_bytes(2)
crlen = b'\xff' + cryptor_data_len.to_bytes(2, byteorder='big')
return sentinel + version + crid + crlen + crd

def decode_header(self, header: bytes) -> Union[None, CryptoHeader]:
Expand Down

0 comments on commit a482de5

Please sign in to comment.