mirror of
https://github.com/hypervortex/VH-Bombsquad-Modded-Server-Files
synced 2025-10-16 12:02:51 +00:00
Added new files
This commit is contained in:
parent
867634cc5c
commit
3a407868d4
1775 changed files with 550222 additions and 0 deletions
39
dist/ba_data/python-site-packages/py_vapid/utils.py
vendored
Normal file
39
dist/ba_data/python-site-packages/py_vapid/utils.py
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import base64
|
||||
import binascii
|
||||
|
||||
|
||||
def b64urldecode(data):
|
||||
"""Decodes an unpadded Base64url-encoded string.
|
||||
|
||||
:param data: data bytes to decode
|
||||
:type data: bytes
|
||||
|
||||
:returns bytes
|
||||
|
||||
"""
|
||||
return base64.urlsafe_b64decode(data + b"===="[len(data) % 4:])
|
||||
|
||||
|
||||
def b64urlencode(data):
|
||||
"""Encode a byte string into a Base64url-encoded string without padding
|
||||
|
||||
:param data: data bytes to encode
|
||||
:type data: bytes
|
||||
|
||||
:returns str
|
||||
|
||||
"""
|
||||
return base64.urlsafe_b64encode(data).replace(b'=', b'').decode('utf8')
|
||||
|
||||
|
||||
def num_to_bytes(n, pad_to):
|
||||
"""Returns the byte representation of an integer, in big-endian order.
|
||||
:param n: The integer to encode.
|
||||
:type n: int
|
||||
:param pad_to: Expected length of result, zeropad if necessary.
|
||||
:type pad_to: int
|
||||
:returns bytes
|
||||
"""
|
||||
h = '%x' % n
|
||||
r = binascii.unhexlify('0' * (len(h) % 2) + h)
|
||||
return b'\x00' * (pad_to - len(r)) + r
|
||||
Loading…
Add table
Add a link
Reference in a new issue