From b6d82861c06591f526ab21a73c9c33523d82e335 Mon Sep 17 00:00:00 2001 From: fangrong Date: Mon, 31 Mar 2025 14:33:21 +0800 Subject: [PATCH] Further fix for seed crypto things --- decrypt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/decrypt.py b/decrypt.py index 27ca385..e7fa0be 100644 --- a/decrypt.py +++ b/decrypt.py @@ -49,7 +49,7 @@ class NcchHdr(Structure): ("makerCode", c_uint16), ("formatVersion", c_uint8), ("formatVersion2", c_uint8), - ("seedcheck", c_char * 4), + ("seedcheck", c_uint8 * 4), ("programId", c_uint8 * 8), ("padding1", c_uint8 * 16), ("logoHash", c_uint8 * 32), @@ -349,7 +349,7 @@ def parseNCCH(fh, fsize, offs=0, idx=0, contentId=0, titleId="", standAlone=1, f fixedCrypto = 0 encrypted = 1 if header.flags[7] & 1: - fixedCrypto = 2 if header.titleId[3] & 16 else 1 + fixedCrypto = 2 if bytearray(header.titleId[::-1])[3] & 16 else 1 print((tab + "Uses fixed-key crypto")) if header.flags[7] & 4: encrypted = 0 @@ -357,7 +357,7 @@ def parseNCCH(fh, fsize, offs=0, idx=0, contentId=0, titleId="", standAlone=1, f useSeedCrypto = header.flags[7] & 32 != 0 keyY = ncchKeyY if useSeedCrypto: - keyY = getNewkeyY(ncchKeyY, header, hexlify(titleId)) + keyY = getNewkeyY(ncchKeyY, header, hexlify(unhexlify(titleId))) print((tab + "Uses 9.6 NCCH Seed crypto with KeyY: %032X" % keyY)) print("") base = os.path.splitext(os.path.basename(fh.name))[0]