mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2025-01-01 12:46:11 +00:00
f530a4e89f
Removed saveDownloadQueue and tagsLanguage from lib settings Revert embedded cover change Fixed bitrate fallback check Use overwriteFile setting when downloading embedded covers Fixed bitrate fallback not working Fixed some issues to make the lib work Implemented spotify plugin back Better handling of albums upcs Fixed queue item not cancelling correctly Code parity with deemix-js Code cleanup with pylint Even more rework on the library More work on the library (WIP) Total rework of the library (WIP) Some rework done on types Added start queue function Made nextitem work on a thread Removed dz as first parameter Started queuemanager refactoring Removed eventlet Co-authored-by: RemixDev <RemixDev64@gmail.com> Reviewed-on: https://git.freezer.life/RemixDev/deemix-py/pulls/4 Co-Authored-By: RemixDev <remixdev@noreply.localhost> Co-Committed-By: RemixDev <remixdev@noreply.localhost>
27 lines
800 B
Python
27 lines
800 B
Python
import binascii
|
|
|
|
from Cryptodome.Cipher import Blowfish, AES
|
|
from Cryptodome.Hash import MD5
|
|
|
|
def _md5(data):
|
|
h = MD5.new()
|
|
h.update(data.encode() if isinstance(data, str) else data)
|
|
return h.hexdigest()
|
|
|
|
def _ecbCrypt(key, data):
|
|
return binascii.hexlify(AES.new(key.encode(), AES.MODE_ECB).encrypt(data))
|
|
|
|
def _ecbDecrypt(key, data):
|
|
return AES.new(key.encode(), AES.MODE_ECB).decrypt(binascii.unhexlify(data.encode("utf-8")))
|
|
|
|
def generateBlowfishKey(trackId):
|
|
SECRET = 'g4el58wc0zvf9na1'
|
|
idMd5 = _md5(trackId)
|
|
bfKey = ""
|
|
for i in range(16):
|
|
bfKey += chr(ord(idMd5[i]) ^ ord(idMd5[i + 16]) ^ ord(SECRET[i]))
|
|
return bfKey
|
|
|
|
def decryptChunk(key, data):
|
|
return Blowfish.new(key, Blowfish.MODE_CBC, b"\x00\x01\x02\x03\x04\x05\x06\x07").decrypt(data)
|