]> jfr.im git - yt-dlp.git/blobdiff - devscripts/generate_aes_testdata.py
[devscripts] `make_changelog`: Stop at `Release ...` commit
[yt-dlp.git] / devscripts / generate_aes_testdata.py
index ff66449ebb9dbbec619596b74524069fe187538b..7f3c88bcfbb7704be3f08e05977f93a9604a19cf 100644 (file)
@@ -1,14 +1,17 @@
-from __future__ import unicode_literals
-
-import codecs
-import subprocess
+#!/usr/bin/env python3
 
+# Allow direct execution
 import os
 import sys
+
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
-from youtube_dl.utils import intlist_to_bytes
-from youtube_dl.aes import aes_encrypt, key_expansion
+
+import codecs
+import subprocess
+
+from yt_dlp.aes import aes_encrypt, key_expansion
+from yt_dlp.utils import intlist_to_bytes
 
 secret_msg = b'Secret message goes here'
 
@@ -23,6 +26,7 @@ def openssl_encode(algo, key, iv):
     out, _ = prog.communicate(secret_msg)
     return out
 
+
 iv = key = [0x20, 0x15] + 14 * [0]
 
 r = openssl_encode('aes-128-cbc', key, iv)
@@ -32,5 +36,11 @@ def openssl_encode(algo, key, iv):
 password = key
 new_key = aes_encrypt(password, key_expansion(password))
 r = openssl_encode('aes-128-ctr', new_key, iv)
-print('aes_decrypt_text')
+print('aes_decrypt_text 16')
+print(repr(r))
+
+password = key + 16 * [0]
+new_key = aes_encrypt(password, key_expansion(password)) * (32 // 16)
+r = openssl_encode('aes-256-ctr', new_key, iv)
+print('aes_decrypt_text 32')
 print(repr(r))