mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-11-09 02:20:36 +00:00
Use more straightforward calls of hashlib.sha1/sha256
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from hashlib import sha1
|
||||
|
||||
from .. import helpers as utils
|
||||
from ..utils import BinaryReader, BinaryWriter
|
||||
|
||||
@@ -6,7 +8,7 @@ class AuthKey:
|
||||
def __init__(self, data):
|
||||
self.key = data
|
||||
|
||||
with BinaryReader(utils.sha1(self.key)) as reader:
|
||||
with BinaryReader(sha1(self.key).digest()) as reader:
|
||||
self.aux_hash = reader.read_long(signed=False)
|
||||
reader.read(4)
|
||||
self.key_id = reader.read_long(signed=False)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
from hashlib import sha1
|
||||
|
||||
from .. import helpers as utils
|
||||
from ..utils import BinaryWriter
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class RSAServerKey:
|
||||
|
||||
with BinaryWriter() as writer:
|
||||
# Write SHA
|
||||
writer.write(utils.sha1(data[offset:offset + length]))
|
||||
writer.write(sha1(data[offset:offset + length]).digest())
|
||||
# Write data
|
||||
writer.write(data[offset:offset + length])
|
||||
# Add padding if required
|
||||
|
||||
Reference in New Issue
Block a user