delete cryptoutils

This commit is contained in:
Victor Shyba 2020-01-03 01:44:41 -03:00 committed by Lex Berezhny
parent c7f391ca44
commit 44f402c64e
6 changed files with 11 additions and 14 deletions

View file

@ -1,4 +1,4 @@
from lbry.cryptoutils import get_lbry_hash_obj from lbry.utils import get_lbry_hash_obj
MAX_BLOB_SIZE = 2 * 2 ** 20 MAX_BLOB_SIZE = 2 * 2 ** 20

View file

@ -9,8 +9,9 @@ from io import BytesIO
from cryptography.hazmat.primitives.ciphers import Cipher, modes from cryptography.hazmat.primitives.ciphers import Cipher, modes
from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.padding import PKCS7 from cryptography.hazmat.primitives.padding import PKCS7
from cryptography.hazmat.backends import default_backend
from lbry.cryptoutils import backend, get_lbry_hash_obj from lbry.utils import get_lbry_hash_obj
from lbry.error import DownloadCancelledError, InvalidBlobHashError, InvalidDataError from lbry.error import DownloadCancelledError, InvalidBlobHashError, InvalidDataError
from lbry.blob import MAX_BLOB_SIZE, blobhash_length from lbry.blob import MAX_BLOB_SIZE, blobhash_length
@ -21,6 +22,7 @@ log = logging.getLogger(__name__)
_hexmatch = re.compile("^[a-f,0-9]+$") _hexmatch = re.compile("^[a-f,0-9]+$")
backend = default_backend()
def is_valid_blobhash(blobhash: str) -> bool: def is_valid_blobhash(blobhash: str) -> bool:

View file

@ -3,7 +3,7 @@ import logging
import asyncio import asyncio
from io import BytesIO from io import BytesIO
from lbry.error import InvalidBlobHashError, InvalidDataError from lbry.error import InvalidBlobHashError, InvalidDataError
from lbry.cryptoutils import get_lbry_hash_obj from lbry.utils import get_lbry_hash_obj
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -1,9 +0,0 @@
import hashlib
from cryptography.hazmat.backends import default_backend
backend = default_backend()
def get_lbry_hash_obj():
return hashlib.sha384()

View file

@ -10,7 +10,7 @@ from cryptography.hazmat.primitives.ciphers.algorithms import AES
from lbry.blob import MAX_BLOB_SIZE from lbry.blob import MAX_BLOB_SIZE
from lbry.blob.blob_info import BlobInfo from lbry.blob.blob_info import BlobInfo
from lbry.blob.blob_file import AbstractBlob, BlobFile from lbry.blob.blob_file import AbstractBlob, BlobFile
from lbry.cryptoutils import get_lbry_hash_obj from lbry.utils import get_lbry_hash_obj
from lbry.error import InvalidStreamDescriptorError from lbry.error import InvalidStreamDescriptorError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -17,8 +17,8 @@ import pkg_resources
import certifi import certifi
import aiohttp import aiohttp
import hashlib
from lbry.schema.claim import Claim from lbry.schema.claim import Claim
from lbry.cryptoutils import get_lbry_hash_obj
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -49,6 +49,10 @@ def datetime_obj(*args, **kwargs):
return datetime.datetime(*args, **kwargs) return datetime.datetime(*args, **kwargs)
def get_lbry_hash_obj():
return hashlib.sha384()
def generate_id(num=None): def generate_id(num=None):
h = get_lbry_hash_obj() h = get_lbry_hash_obj()
if num is not None: if num is not None: