chore: use inline dependency metadata

This commit is contained in:
beerpsi 2025-02-10 08:40:37 +00:00
parent ecaec6d942
commit 3dff5f3c58

View File

@ -1,3 +1,10 @@
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "construct",
# "pycryptodome",
# ]
# ///
# pyright: reportMissingTypeStubs=false, reportOperatorIssue=false, reportUnknownArgumentType=false, reportUnknownMemberType=false
from math import ceil
import os
@ -221,7 +228,7 @@ with open(INPUT_FILE, "rb") as fin, open(OUTPUT_FILE, "w+b") as fout:
null_byte_count = BOOTID["block_size"] - (total_written % BOOTID["block_size"])
while null_byte_count > 0:
page_iv = get_page_iv(iv, total_written)
page_iv = get_page_iv(ENCRYPTION_IV, total_written)
cipher = AES.new(ENCRYPTION_KEY, AES.MODE_CBC, page_iv)
encrypted = cipher.encrypt(b"\x00" * 4096)
total_written += fout.write(encrypted)