Restyled by black
This commit is contained in:
parent
597da1f5a1
commit
cfd1ac05fb
|
@ -7,8 +7,7 @@ class ApResolver:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def request(service_type: str):
|
def request(service_type: str):
|
||||||
response = requests.get("{}?type={}".format(ApResolver.base_url,
|
response = requests.get("{}?type={}".format(ApResolver.base_url, service_type))
|
||||||
service_type))
|
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -3,16 +3,106 @@ import os
|
||||||
|
|
||||||
|
|
||||||
class DiffieHellman:
|
class DiffieHellman:
|
||||||
prime_bytes: bytearray = bytes([
|
prime_bytes: bytearray = bytes(
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0x0f, 0xda, 0xa2,
|
[
|
||||||
0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, 0x80, 0xdc, 0x1c, 0xd1,
|
0xFF,
|
||||||
0x29, 0x02, 0x4e, 0x08, 0x8a, 0x67, 0xcc, 0x74, 0x02, 0x0b, 0xbe, 0xa6,
|
0xFF,
|
||||||
0x3b, 0x13, 0x9b, 0x22, 0x51, 0x4a, 0x08, 0x79, 0x8e, 0x34, 0x04, 0xdd,
|
0xFF,
|
||||||
0xef, 0x95, 0x19, 0xb3, 0xcd, 0x3a, 0x43, 0x1b, 0x30, 0x2b, 0x0a, 0x6d,
|
0xFF,
|
||||||
0xf2, 0x5f, 0x14, 0x37, 0x4f, 0xe1, 0x35, 0x6d, 0x6d, 0x51, 0xc2, 0x45,
|
0xFF,
|
||||||
0xe4, 0x85, 0xb5, 0x76, 0x62, 0x5e, 0x7e, 0xc6, 0xf4, 0x4c, 0x42, 0xe9,
|
0xFF,
|
||||||
0xa6, 0x3a, 0x36, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
0xFF,
|
||||||
])
|
0xFF,
|
||||||
|
0xC9,
|
||||||
|
0x0F,
|
||||||
|
0xDA,
|
||||||
|
0xA2,
|
||||||
|
0x21,
|
||||||
|
0x68,
|
||||||
|
0xC2,
|
||||||
|
0x34,
|
||||||
|
0xC4,
|
||||||
|
0xC6,
|
||||||
|
0x62,
|
||||||
|
0x8B,
|
||||||
|
0x80,
|
||||||
|
0xDC,
|
||||||
|
0x1C,
|
||||||
|
0xD1,
|
||||||
|
0x29,
|
||||||
|
0x02,
|
||||||
|
0x4E,
|
||||||
|
0x08,
|
||||||
|
0x8A,
|
||||||
|
0x67,
|
||||||
|
0xCC,
|
||||||
|
0x74,
|
||||||
|
0x02,
|
||||||
|
0x0B,
|
||||||
|
0xBE,
|
||||||
|
0xA6,
|
||||||
|
0x3B,
|
||||||
|
0x13,
|
||||||
|
0x9B,
|
||||||
|
0x22,
|
||||||
|
0x51,
|
||||||
|
0x4A,
|
||||||
|
0x08,
|
||||||
|
0x79,
|
||||||
|
0x8E,
|
||||||
|
0x34,
|
||||||
|
0x04,
|
||||||
|
0xDD,
|
||||||
|
0xEF,
|
||||||
|
0x95,
|
||||||
|
0x19,
|
||||||
|
0xB3,
|
||||||
|
0xCD,
|
||||||
|
0x3A,
|
||||||
|
0x43,
|
||||||
|
0x1B,
|
||||||
|
0x30,
|
||||||
|
0x2B,
|
||||||
|
0x0A,
|
||||||
|
0x6D,
|
||||||
|
0xF2,
|
||||||
|
0x5F,
|
||||||
|
0x14,
|
||||||
|
0x37,
|
||||||
|
0x4F,
|
||||||
|
0xE1,
|
||||||
|
0x35,
|
||||||
|
0x6D,
|
||||||
|
0x6D,
|
||||||
|
0x51,
|
||||||
|
0xC2,
|
||||||
|
0x45,
|
||||||
|
0xE4,
|
||||||
|
0x85,
|
||||||
|
0xB5,
|
||||||
|
0x76,
|
||||||
|
0x62,
|
||||||
|
0x5E,
|
||||||
|
0x7E,
|
||||||
|
0xC6,
|
||||||
|
0xF4,
|
||||||
|
0x4C,
|
||||||
|
0x42,
|
||||||
|
0xE9,
|
||||||
|
0xA6,
|
||||||
|
0x3A,
|
||||||
|
0x36,
|
||||||
|
0x20,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
0xFF,
|
||||||
|
]
|
||||||
|
)
|
||||||
prime: int = int.from_bytes(prime_bytes, "big")
|
prime: int = int.from_bytes(prime_bytes, "big")
|
||||||
private_key: int
|
private_key: int
|
||||||
public_key: int
|
public_key: int
|
||||||
|
|
|
@ -3,20 +3,16 @@ from librespot.standard.FilterInputStream import FilterInputStream
|
||||||
|
|
||||||
|
|
||||||
class DataInputStream(FilterInputStream, DataInput):
|
class DataInputStream(FilterInputStream, DataInput):
|
||||||
def read(self,
|
def read(self, b: bytearray = None, offset: int = None, length: int = None) -> int:
|
||||||
b: bytearray = None,
|
|
||||||
offset: int = None,
|
|
||||||
length: int = None) -> int:
|
|
||||||
if b is not None and offset is None and length is None:
|
if b is not None and offset is None and length is None:
|
||||||
return self.input_stream.read(b, 0, len(b))
|
return self.input_stream.read(b, 0, len(b))
|
||||||
if b is not None and offset is not None and length is not None:
|
if b is not None and offset is not None and length is not None:
|
||||||
return self.input_stream.read(b, offset, length)
|
return self.input_stream.read(b, offset, length)
|
||||||
raise TypeError()
|
raise TypeError()
|
||||||
|
|
||||||
def read_fully(self,
|
def read_fully(
|
||||||
b: bytearray = None,
|
self, b: bytearray = None, offset: int = None, length: int = None
|
||||||
offset: int = None,
|
) -> None:
|
||||||
length: int = None) -> None:
|
|
||||||
if b is not None and offset is None and length is None:
|
if b is not None and offset is None and length is None:
|
||||||
offset = 0
|
offset = 0
|
||||||
length = len(b)
|
length = len(b)
|
||||||
|
@ -94,14 +90,16 @@ class DataInputStream(FilterInputStream, DataInput):
|
||||||
|
|
||||||
def read_long(self) -> int:
|
def read_long(self) -> int:
|
||||||
self.read_fully(self.read_buffer, 0, 8)
|
self.read_fully(self.read_buffer, 0, 8)
|
||||||
return (self.read_buffer[0] << 56) + \
|
return (
|
||||||
((self.read_buffer[1] & 255) << 48) + \
|
(self.read_buffer[0] << 56)
|
||||||
((self.read_buffer[2] & 255) << 40) + \
|
+ ((self.read_buffer[1] & 255) << 48)
|
||||||
((self.read_buffer[3] & 255) << 32) + \
|
+ ((self.read_buffer[2] & 255) << 40)
|
||||||
((self.read_buffer[4] & 255) << 24) + \
|
+ ((self.read_buffer[3] & 255) << 32)
|
||||||
((self.read_buffer[5] & 255) << 16) + \
|
+ ((self.read_buffer[4] & 255) << 24)
|
||||||
((self.read_buffer[6] & 255) << 8) + \
|
+ ((self.read_buffer[5] & 255) << 16)
|
||||||
((self.read_buffer[7] & 255) << 0)
|
+ ((self.read_buffer[6] & 255) << 8)
|
||||||
|
+ ((self.read_buffer[7] & 255) << 0)
|
||||||
|
)
|
||||||
|
|
||||||
def read_float(self) -> float:
|
def read_float(self) -> float:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue