From f17c302327d20842b0ecf9b064259e522121f662 Mon Sep 17 00:00:00 2001 From: uh_wot <3631986-uh_wot@users.noreply.gitlab.com> Date: Mon, 23 Mar 2020 17:03:04 +0100 Subject: [PATCH 1/2] replaced pyaes and hashlib with pycryptodome equivalents --- deemix/api/deezer.py | 8 ++++---- requirements.txt | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index e4c9336..862ae58 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import binascii -import hashlib +from Crypto.Hash import MD5 -from Crypto.Cipher import Blowfish +from Crypto.Cipher import Blowfish, AES import pyaes import requests @@ -281,14 +281,14 @@ class Deezer: i += 1 def _md5(self, data): - h = hashlib.new("md5") + h = MD5.new() h.update(str.encode(data) if isinstance(data, str) else data) return h.hexdigest() def _ecb_crypt(self, key, data): res = b'' for x in range(int(len(data) / 16)): - res += binascii.hexlify(pyaes.AESModeOfOperationECB(key).encrypt(data[:16])) + res += binascii.hexlify(AES.new(key, AES.MODE_ECB).encrypt(data[:16])) data = data[16:] return res diff --git a/requirements.txt b/requirements.txt index af35906..1edcf91 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -pyaes pycryptodome mutagen click From b922a61e10de554b398691989d6ce49266fd80f0 Mon Sep 17 00:00:00 2001 From: uh_wot <3631986-uh_wot@users.noreply.gitlab.com> Date: Mon, 23 Mar 2020 17:04:58 +0100 Subject: [PATCH 2/2] replaced pycryptodome with pycryptodomex to avoid conflicts with pycrypto --- deemix/api/deezer.py | 4 ++-- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 862ae58..e1b71c4 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 import binascii -from Crypto.Hash import MD5 +from Cryptodome.Hash import MD5 -from Crypto.Cipher import Blowfish, AES +from Cryptodome.Cipher import Blowfish, AES import pyaes import requests diff --git a/requirements.txt b/requirements.txt index 1edcf91..cf8f90a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pycryptodome +pycryptodomex mutagen click requests