mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-14 05:26:36 +03:00
parent
301da16f29
commit
a6c898f8d1
|
@ -107,17 +107,17 @@ class CryptoTests(unittest.TestCase):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def test_generate_key_data_from_nonce():
|
def test_generate_key_data_from_nonce():
|
||||||
server_nonce = b'I am the server nonce.'
|
server_nonce = int.from_bytes(b'The 16-bit nonce', byteorder='little')
|
||||||
new_nonce = b'I am a new calculated nonce.'
|
new_nonce = int.from_bytes(b'The new, calculated 32-bit nonce', byteorder='little')
|
||||||
|
|
||||||
key, iv = utils.generate_key_data_from_nonce(server_nonce, new_nonce)
|
key, iv = utils.generate_key_data_from_nonce(server_nonce, new_nonce)
|
||||||
expected_key = b'?\xc4\xbd\xdf\rWU\x8a\xf5\x0f+V\xdc\x96up\x1d\xeeG\x00\x81|\x1eg\x8a\x8f{\xf0y\x80\xda\xde'
|
expected_key = b'/\xaa\x7f\xa1\xfcs\xef\xa0\x99zh\x03M\xa4\x8e\xb4\xab\x0eE]b\x95|\xfe\xc0\xf8\x1f\xd4\xa0\xd4\xec\x91'
|
||||||
expected_iv = b'Q\x9dpZ\xb7\xdd\xcb\x82_\xfa\xf4\x90\xecn\x10\x9cD\xd2\x01\x8d\x83\xa0\xa4^\xb8\x91,\x7fI am'
|
expected_iv = b'\xf7\xae\xe3\xc8+=\xc2\xb8\xd1\xe1\x1b\x0e\x10\x07\x9fn\x9e\xdc\x960\x05\xf9\xea\xee\x8b\xa1h The '
|
||||||
|
|
||||||
assert key == expected_key, 'Key ("{}") does not equal expected ("{}")'.format(
|
assert key == expected_key, 'Key ("{}") does not equal expected ("{}")'.format(
|
||||||
key, expected_key)
|
key, expected_key)
|
||||||
assert iv == expected_iv, 'Key ("{}") does not equal expected ("{}")'.format(
|
assert iv == expected_iv, 'IV ("{}") does not equal expected ("{}")'.format(
|
||||||
key, expected_iv)
|
iv, expected_iv)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def test_fingerprint_from_key():
|
def test_fingerprint_from_key():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user