nicoboss/nsZip

Task fails encrypting file

profucius opened this issue · 8 comments

I am converting a large NSP file (16gb), but it fails towards the end of the encryption phase. It successfully decrypts, and runs through all the blocks, then when encrypting (I've tried this multiple times) it will catch approx here.

PS- Not sure why the error mentions Users\nico\ as I do not have a user named that.

error-message

Thanks a lot for reporting this issue. Could you please let me know on what game (Name or TitleID) this issue occurs so I can reproduce and fix it? What you get is a verification error which means something went wrong without the program noticing it and so purposely crashed during verification to prevent delivering you a corrupted output. The reason why the error is mentioning my username is because the debug information that are shipped with the software where created on my PC and so doesn’t matter.

I found another NSP that fails in the same way: Katana Zero [v65535]

I tested both games and they worked perfectly fine for me using nsZip v2.0.0p2. This is probably due to the NSPs you are trying to compress aren’t clean. The first half of the NCA files sha256 hash is supposed to match the NCA filename. This is no longer the case if the NSP was modified for example to use mods without LayeredFS or in the past to remove fake tickets from illegally obtained games in the wrong hope to make banns less likely und are still circulating around some dark places on the internet. Maybe there are also some dumping tools not dumping them properly or they were damaged before dumping for some reason.

I could easily add support for corrupted NSP files to nsZip by hashing the encrypted original NCA if the filename doesn't match the hash but let's first make sure my assumption are true for this issue because in the end it could also be some compatibility issue that's causing something to not work properly on your PC and we need to investigate further.

I wrote and attached a nice Python script for you which you can use to verify if your NSP file is corrupted or not: verifyNSP.txt
In order to run it install Python 3, copy the script into the same folder as your NSP file and run it in your CMD or PS (Shift + Right click the on an empty space inside the folder and select "Open PowerShell Window here") using "python.exe .\verifyNSP.txt" and send me the last few lines showing the hashes like I did for my "Katana Zero v65536.nsp" below. Please let me know if you used any wired tool to dump the NSP but don't link illegal pages because I don't want to give Nintendo any legal reason to take this project down. In case you have Discord and prefer comunicating over there feel free to post your Username#Tag.

Last few lines of output I'm getting from verifyNSP.py I'm getting from my script:

06c7dab4888ba1883dbc45ebdf5ca6ac5bc24e5c789000c4350810b7c19e1aa4 010029600d56a8000000000000000008.cert NO_NCA
7ee593e3220618d1fd51626e7ea4f7420e49ceba3aaf664ff6171175156f1d84 010029600d56a8000000000000000008.tik NO_NCA
662c81c4fb798b4ca1e63399fae0922465ce3b1eec0cfb363a88602cc62b8215 662c81c4fb798b4ca1e63399fae09224.nca MATCH
7758a668f0f0e4daf28ac60a6bec72bcffc40362a660ba099f757ba2231de2c9 7758a668f0f0e4daf28ac60a6bec72bc.nca MATCH
d708fb92983de527bdc3015a3d2ca468cce7becedf0a624cd4905411bcafd48c d708fb92983de527bdc3015a3d2ca468.cnmt.nca MATCH
f66ab6780027d3c6c56555ef145e6edcdeaafe630ac9511130139f2f4abc1048 d708fb92983de527bdc3015a3d2ca468.cnmt.xml NO_NCA
ddc915aadde2329473e656f378eddd056d31f1d1d5b75f8196f9d8d3667acf0c ddc915aadde2329473e656f378eddd05.nca MATCH
All hashes matched!
CLEAN NSP!

Edit: Sorry forgot to mention that you also need to copy hactool.exe into the folder of your NSP in order to successfully run verifyNSP.txt

Alright I was able to grab what you asked for in your write-up above. I found many more examples of NSPs that would not process (although the majority of NSPs do process fine), so this time I used two different games. I did not dump these myself but obtained them online about a year ago so I don't remember where. They both say "Clean NSP"

Graceful Explosion Machine [v4]

06c7dab4888ba1883dbc45ebdf5ca6ac5bc24e5c789000c4350810b7c19e1aa4 01004d10020f28000000000000000003.cert NO_NCA
9277c8bcc19297a676c55a3ccaba2aca5239e8c5faa939a75608c0535bf9bc26 01004d10020f28000000000000000003.tik NO_NCA
81d5a5efc8615193c6df76560a3e7c61122818ae7c304d67e950912cc3f0ddb7 81d5a5efc8615193c6df76560a3e7c61.nca MATCH
c17da79ef5841c1df85be2f404fbce87c32657992eb703bae2b1f292aac594e1 c17da79ef5841c1df85be2f404fbce87.cnmt.nca MATCH
39e175036cfb6bd4ab18dab4f85e20203316128c6c0b98ac155f55b01eb2d9f0 c17da79ef5841c1df85be2f404fbce87.cnmt.xml NO_NCA
eb93e454b86d9dcfffd171240cb10c78d2f2b25c7b199e53d1ed77c7830e5e9c eb93e454b86d9dcfffd171240cb10c78.nca MATCH
ef99c5381ee44b5ff8a700ed5d50efe14388621593f9f53500d8eb1fc21c1004 ef99c5381ee44b5ff8a700ed5d50efe1.nca MATCH
f3bdba575f2b0e448a9e0fef23418aa07984cbbfd2e9be06643f6a0b444d14a9 f3bdba575f2b0e448a9e0fef23418aa0.nca MATCH
All hashes matched!
CLEAN NSP!

Gorgoa [v4]

06c7dab4888ba1883dbc45ebdf5ca6ac5bc24e5c789000c4350810b7c19e1aa4 0100f2a005c988000000000000000004.cert NO_NCA
89185af0b4c5ed58c488df15d1364d697ecc8f145790c709e34654e0f617550c 0100f2a005c988000000000000000004.tik NO_NCA
1c1fef27442b3297de4a3f1eea399c624afe90574fc7812bb87569e3b4f9205f 1c1fef27442b3297de4a3f1eea399c62.cnmt.nca MATCH
bacd78b7d9c24c85bfaa0e452d24feb98f53974ec37d74248d3600a4a753d64c 1c1fef27442b3297de4a3f1eea399c62.cnmt.xml NO_NCA
9d101266651416355706a2dfc12a50a48d1faeaabb154e29c30e0c23ce3eb907 9d101266651416355706a2dfc12a50a4.nca MATCH
a7369eef3e6fd800440cffe2b1a838336a9ecad74565c1aa182c120513a9590f a7369eef3e6fd800440cffe2b1a83833.nca MATCH
d834c578ffddb59aba2656286c249e64f98cf90cb77eb6a047b56dfdd8b5142c d834c578ffddb59aba2656286c249e64.nca MATCH
f5d7e457dce880947b8f804f5164d965b7a6681317162de3603888d5a8a53d1a f5d7e457dce880947b8f804f5164d965.nca MATCH
All hashes matched!
CLEAN NSP!

@nicoboss Hi there, checking in, is there anything else I can test or do to help?

Great that you are still willing to help with this issue! I really tried hard but was never able to recreate it so far even when testing games where nearly all NCAs match your above posted hashes.

Most helpful would probably be testing nsZip_v2.0.0_debug_v1_Issue3.zip and see if the issue happens there too. This will let us know if this issue only affects the portable preview builds which don’t have any software requirements checks or also happens on clean release build like the one posted above. Please keep in mind that even though this was built like a release build it’s the complete opposite in terms of stability and won’t receive any updates others then builds made for the sake of fixing this issue and so should be uninstalled once this issue is resolved.

Giving me your PC configurations would be helpful as I could use them to recreate an envirement similar to your PC inside a virtual machine. To get hardware/software information go Windows & R => enter dxdiag => "Save All information" also go Powershell and enter the following command to get a list of all installed programs - I'm especially interested in the .NET ones.

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > InstalledPrograms.txt

If you have the time you could send me your Discord username and we could try solving the issue together with tools like live chat, screenshots, voice chat and screen sharing. I currently have a lot of time until university starts again in around a month but I definitely don't expect you having time for such things and completely understand if you prefer keep writing here.

I am having the same issue with astral chain, how do I go about fixing it? Also so when you install the compress nsz will it install as a smaller game on my switch card?