X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Faes.py;h=9a0c93fa6f4efb415f7e6dad25239a4c219a2542;hb=22c8b525458c8203c0709a523c646b8d152f03b0;hp=278f8bb8264947f0ae47de942d693a1c996ad78f;hpb=550bfd4cbd1236fdb02abf99a81fc52a2680a8dc;p=youtube-dl diff --git a/youtube_dl/aes.py b/youtube_dl/aes.py index 278f8bb82..9a0c93fa6 100644 --- a/youtube_dl/aes.py +++ b/youtube_dl/aes.py @@ -3,7 +3,7 @@ __all__ = ['aes_encrypt', 'key_expansion', 'aes_ctr_decrypt', 'aes_decrypt_text' import base64 from math import ceil -from .utils import bytes_to_intlist +from .utils import bytes_to_intlist, intlist_to_bytes BLOCK_SIZE_BYTES = 16 @@ -18,7 +18,7 @@ def aes_ctr_decrypt(data, key, counter): @returns {int[]} decrypted data """ expanded_key = key_expansion(key) - block_count = int(ceil(float(len(data)) // BLOCK_SIZE_BYTES)) + block_count = int(ceil(float(len(data)) / BLOCK_SIZE_BYTES)) decrypted_data=[] for i in range(block_count): @@ -118,7 +118,7 @@ def aes_decrypt_text(data, password, key_size_bytes): return temp decrypted_data = aes_ctr_decrypt(cipher, key, Counter()) - plaintext = ''.join(map(lambda x: chr(x), decrypted_data)) + plaintext = intlist_to_bytes(decrypted_data) return plaintext