Skip to content

Commit

Permalink
Both MASK and random number using big-endian byte order
Browse files Browse the repository at this point in the history
  • Loading branch information
SunFulong committed Apr 13, 2024
1 parent f084051 commit b59b114
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autobahn/util.py
Expand Up @@ -279,7 +279,7 @@ def __next__(self):


# 8 byte mask with 53 LSBs set (WAMP requires IDs from [1, 2**53]
_WAMP_ID_MASK = struct.unpack("@Q", b"\x00\x1f\xff\xff\xff\xff\xff\xff")[0]
_WAMP_ID_MASK = struct.unpack(">Q", b"\x00\x1f\xff\xff\xff\xff\xff\xff")[0]


def rid():
Expand All @@ -298,7 +298,7 @@ def rid():
:returns: A random integer ID.
:rtype: int
"""
return struct.unpack("@Q", os.urandom(8))[0] & _WAMP_ID_MASK or 2 ** 53
return struct.unpack(">Q", os.urandom(8))[0] & _WAMP_ID_MASK or 2 ** 53


# noinspection PyShadowingBuiltins
Expand Down

0 comments on commit b59b114

Please sign in to comment.