Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

NDecrypt 3DS: Difference between revisions

From GameBrew
m Text replacement - "image = https://dlhb.gamebrew.org/3dshomebrew/" to "image = "
0.5.1
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Infobox 3DS Homebrews
{{Infobox 3DS Homebrews
| title = NDecrypt
|title=NDecrypt
| image = NDecrypt.jpg|250px
|image=Ndecrypt2.png
| type = PC Utilities
|description=Cartridge encrypt/decrypt.
| version=v0.2.2
|author=SabreTools
| lastupdated = 2020/12/18
|lastupdated=2025/05/04
| licence = Mixed
|type=File Operation
| author = SabreTools
|version=0.5.1
| website = https://github.com/SabreTools/NDecrypt
|license=MIT
| download = https://dlhb.gamebrew.org/3dshomebrew/NDecrypt.rar
|download=https://github.com/SabreTools/NDecrypt/releases/latest
| source = https://github.com/SabreTools/NDecrypt
|website=https://github.com/SabreTools/NDecrypt
}}
|source=https://github.com/SabreTools/NDecrypt
<youtube>iL5R83zxXpU</youtube>
}}<!--ndecrypt.7z-->
NDecrypt is a tool that allows you to encrypt and decrypt your personally dumped NDS and N3DS roms with minimal hassle. The only caveat right now is that you need a <code>keys.bin</code> file for your personally obtained encryption keys.


== NDecrypt ==
This is a code port of 3 different programs: 3ds_encrypt.py, 3ds_decrypt.py and woodsec (part of [https://github.com/TuxSH/wooddumper wooddumper]).


A simple tool for simple people.
==User guide==
You will need [https://github.com/SabreTools/NDecrypt/blob/master/README.md#i-feel-like-something-is-missing at least one of these files] in order to use it.


== What is this? ==
<pre>Usage: NDecrypt <operation> [flags] <path> ...


This is a code port of 3 different programs:
Possible values for <operation>:
e, encrypt - Encrypt the input files
d, decrypt - Decrypt the input files
i, info    - Output file information


* <code>3ds_encrypt.py</code>
Possible values for [flags] (one or more can be used):
* <code>3ds_decrypt.py</code>
-?, -h, --help          Display this help text and quit
* <code>woodsec</code> (part of [https://github.com/TuxSH/wooddumper wooddumper])
-c, --config <path>     Path to config.json
-d, --development        Enable using development keys, if available
-f, --force              Force operation by avoiding sanity checks
--hash                  Output size and hashes to a companion file


== No really, what is this? ==
<path> can be any file or folder that contains uncompressed items.
More than one path can be specified at a time.
</pre>


This tool allows you to encrypt and decrypt your personally dumped NDS and N3DS roms with minimal hassle. The only caveat right now is that you need a <code>keys.bin</code> file for your personally obtained encryption keys.
Additional Notes:
* Input files are overwritten, even if they are only partially processed. You should make backups of the files you're working on if you're worried about this.
* Mixed folders or inputs are also accepted, you can decrypt or encrypt multiple files, regardless of their type. This being said, you can only do encrypt ''OR'' decrypt at one time.
* Required files will automatically be searched for in the application runtime directory as well as <code>%HOME%/.config/ndecrypt</code>, also known as <code>%USERPROFILE%\.config\ndecrypt</code> on Windows.


== So how do I use this? ==
==Changelog==
'''v0.5.0'''
* Full Changelog: https://github.com/SabreTools/NDecrypt/compare/0.4.2...0.5.0
'''v0.4.2'''
* <code>options.OutputHashes</code> is being correctly set when the <code>--hash</code> flag is supplied.<br />
'''v0.4.1'''
* <code>options.InputPaths</code> is being correctly used instead of <code>args</code> when finding input paths to process.
'''v0.4.0'''
* All dependent libraries have been updated to the newest versions for better compatibility.
* .NET Standard 2.0 and 2.1 support has been added to <code>NDecrypt.Core</code>.
* Internal reorganization of the program code to match other reference implementations.
* Support for <code>keys.bin</code> and <code>aes_keys.txt</code> has been removed; please see the README for a helpful script to convert to the new <code>config.json</code> format.
* Start preparing for the ability to write outputs to a new file; expected to be in 0.4.1.
'''v0.3.2'''
* Updated default build to .NET 9 and added build support going all the way back to .NET Framework 2.0.
* Added support for Windows. OSX, and Linux ARM64.
* Overhaul and simplification of code structure.
* Migration to shared libraries for models, serialization, and hashing.
* Overhaul on automatic builds and testing, including unified build scripts.
* Introduction of the new <code>info</code> operation to quickly scan and check the status of multiple files.
* Automatic searching for required files in more locations.
* Introduction of the new <code>config.json</code> configuration file.
** Meant to replace both <code>keys.bin</code> and <code>aes_keys.txt</code>.
** Will be the default as of 0.4.x.
** Requires Nintendo DS value to be provided.
* Added automatic validation of keys if they are supplied.
'''v0.3.1'''
*For users who wanted to start using 0.3.x, please start with this version. The previous version had undiscovered bugs related to many of the cleanup changes that I introduced over the course of a couple months. It was lightly tested and nobody reported issues, so they were not obvious until after 0.3.0 went out.
'''v0.3.0'''
*What's Changed
** Fix opeation typo by [https://github.com/soxhi8 @soxhi8] in [https://github.com/SabreTools/NDecrypt/pull/10 #10]
** add support for .nds.enc extension by [https://github.com/spiritfader @spiritfader] in [https://github.com/SabreTools/NDecrypt/pull/16 #16]
*New Contributors
** [https://github.com/soxhi8 @soxhi8] made their first contribution in [https://github.com/SabreTools/NDecrypt/pull/10 #10]
** [https://github.com/spiritfader @spiritfader] made their first contribution in [https://github.com/SabreTools/NDecrypt/pull/16 #16]
'''v0.2.5'''
* License has been correctly set to MIT instead of the "whatever" mentioned before.
* Build targets for Windows x86, Windows x64, Linux x64, and OSX x64 have been added for packaging.
* .NET Core 3.1 has been removed as a build version.
* AppVeyor has been enabled to allow for easier testing of WIP builds.


NDecrypt.exe <operation> [flags] <path> ...
'''v0.2.4'''
* .NET 5 support has been dropped.
* .NET 6 support (hashing and encrypt/decrypt) have been fixed.
* Internal structure changed to be more library-oriented.


Possible values for <operation>: e, encrypt - Encrypt the input files d, decrypt - Decrypt the input files
'''v0.2.3'''
* Add support for outputting file hashes to a companion file.
* Add support for alternate keyfile paths.
* Add support for Citra aes_keys.txt.
* Major internal cleanups and code separation.
* Converted core library to .NET Standard 2.0.
* Added .NET 6.0 as build target for main executable.


Possible values for [flags] (one or more can be used): -dev, --development - Enable using development keys, if available -f, --force - Force operation by avoiding sanity checks
'''v0.2.2'''
* Added a couple of fixes for NDS Prince of Persia carts that have mastering oddities.
* Added the .ids iQue DS extension to matching.
* Fixed the matching criteria for some of the NDS signatures.
* Added more improperly decrypted empty secure area NDS signatures.
* Remove forced pause at end of program run.
* Make keys.bin only required for 3DS and New 3DS processing.
* Add some try/catch blocks around processing so it doesn't hard crash (issue with incorrectly-named BIOS files).


<path> can be any file or folder that contains uncompressed items. More than one path can be specified at a time.
'''v0.2.1'''
* Merged two projects into one again, based on the Core version from last time. No changes to supported frameworks due to this.
* Reorganized a bit of the code internally in case other cart types get supported in the future.
* Added a couple of fixes for NDS Dragon Quest V carts that have mastering oddities.


'''Note:''' This overwrites the input files, so make backups if you're working on your original, personal dumps.
'''v0.2.0'''
* Internal cleanup of most of the code.
* Removed .NET Framework 4.6.1 build.
* Added .NET Framework 4.8, .NET Core 3.1, and .NET 5.0 builds.
* Fixed NDS secure areas.
* Fixed larger game carts.
* Fixed encrypting N3DS carts.
* Add force flags for NDS and N3DS.


'''Note:''' Mixed folders or inputs are also accepted, you can decrypt or encrypt multiple files, regardless of their type. This being said, you can only do encrypt OR decrypt at one time.
==Credits==
* Thanks to the developers of the original programs for doing the actual hard work to figure things out.  
* Also thanks to everyone who helped to test this against the original programs and made code suggestions.


== I feel like something is missing... ==
Disclaimer: This program is only for use with personally dumped files and keys and is not meant for enabling illegal activity.


You are! In fact, you may be asking, &quot;Hey, what was that <code>keys.bin</code> you mentioned??&quot;. I'm glad you asked. It's used only for Nintendo 3DS and New 3DS files. Since some people don't like reading code, you need the 9 16-bit keys in little endian format (most common extraction methods produce big endian, so keep that in mind). It's recommended that you fill with 0x00 if you don't have access to a particular value so it doesn't mess up the read. They need to be in the following order:
==External links==
 
* GitHub - https://github.com/SabreTools/NDecrypt
* Hardware constant
* KeyX0x18
* KeyX0x1B
* KeyX0x25
* KeyX0x2C
* DevKeyX0x18
* DevKeyX0x1B
* DevKeyX0x25
* DevKeyX0x2C
 
The last 4 are only required if you use the <code>-dev</code> flag. Once again, don't ask for these, please. If you're missing a required key, then things won't work. Don't blame me, blame society. Or something. And yes, I'll fix this being required across the board at some point.
 
== But does it work? ==
 
As much as I'd like to think that this program is entirely without flaws, numbers need to speak for themselves sometimes. Here's a list of the supported sets and their current compatibility percentages with woodsec and the Python scripts (as of 2020-12-19):
 
* '''Nintendo DS''' - &gt;99% compatible (Both encryption and decryption)
* '''Nintendo DSi''' - 100% compatible (Both encryption and decryption)
* '''Nintendo 3DS''' - 100% compatible (Both encryption and decryption)
* '''Nintendo New 3DS''' - 100% compatible (Both encryption and decryption)
 
Please note the above numbers are based on the current, documented values. The notable exceptions to this tend to be unlicensed carts which may be dumped incorrectly or have odd information stored in their secure area.
 
== Anything else? ==
 
I'd like to thank the developers of the original programs for doing the actual hard work to figure things out. I'd also like to thank everyone who helped to test this against the original programs and made code suggestions.
 
Unofficially, this is entirely, 100% FOSS, no strings attached. I keep forgetting what license that is.
 
== Disclaimer ==
 
This program is '''ONLY''' for use with personally dumped files and keys and is not meant for enabling illegal activity. I do not condone using this program for anything other than personal use and research. If this program is used for anything other than that, I cannot be held liable for anything that happens.

Latest revision as of 04:17, 8 May 2026

NDecrypt
General
AuthorSabreTools
TypeFile Operation
Version0.5.1
LicenseMIT License
Last Updated2025/05/04
Links
Download
Website
Source

NDecrypt is a tool that allows you to encrypt and decrypt your personally dumped NDS and N3DS roms with minimal hassle. The only caveat right now is that you need a keys.bin file for your personally obtained encryption keys.

This is a code port of 3 different programs: 3ds_encrypt.py, 3ds_decrypt.py and woodsec (part of wooddumper).

User guide

You will need at least one of these files in order to use it.

Usage: NDecrypt <operation> [flags] <path> ...

Possible values for <operation>:
e, encrypt - Encrypt the input files
d, decrypt - Decrypt the input files
i, info    - Output file information

Possible values for [flags] (one or more can be used):
-?, -h, --help           Display this help text and quit
-c, --config <path>      Path to config.json
-d, --development        Enable using development keys, if available
-f, --force              Force operation by avoiding sanity checks
--hash                   Output size and hashes to a companion file

<path> can be any file or folder that contains uncompressed items.
More than one path can be specified at a time.

Additional Notes:

  • Input files are overwritten, even if they are only partially processed. You should make backups of the files you're working on if you're worried about this.
  • Mixed folders or inputs are also accepted, you can decrypt or encrypt multiple files, regardless of their type. This being said, you can only do encrypt OR decrypt at one time.
  • Required files will automatically be searched for in the application runtime directory as well as %HOME%/.config/ndecrypt, also known as %USERPROFILE%\.config\ndecrypt on Windows.

Changelog

v0.5.0

v0.4.2

  • options.OutputHashes is being correctly set when the --hash flag is supplied.

v0.4.1

  • options.InputPaths is being correctly used instead of args when finding input paths to process.

v0.4.0

  • All dependent libraries have been updated to the newest versions for better compatibility.
  • .NET Standard 2.0 and 2.1 support has been added to NDecrypt.Core.
  • Internal reorganization of the program code to match other reference implementations.
  • Support for keys.bin and aes_keys.txt has been removed; please see the README for a helpful script to convert to the new config.json format.
  • Start preparing for the ability to write outputs to a new file; expected to be in 0.4.1.

v0.3.2

  • Updated default build to .NET 9 and added build support going all the way back to .NET Framework 2.0.
  • Added support for Windows. OSX, and Linux ARM64.
  • Overhaul and simplification of code structure.
  • Migration to shared libraries for models, serialization, and hashing.
  • Overhaul on automatic builds and testing, including unified build scripts.
  • Introduction of the new info operation to quickly scan and check the status of multiple files.
  • Automatic searching for required files in more locations.
  • Introduction of the new config.json configuration file.
    • Meant to replace both keys.bin and aes_keys.txt.
    • Will be the default as of 0.4.x.
    • Requires Nintendo DS value to be provided.
  • Added automatic validation of keys if they are supplied.

v0.3.1

  • For users who wanted to start using 0.3.x, please start with this version. The previous version had undiscovered bugs related to many of the cleanup changes that I introduced over the course of a couple months. It was lightly tested and nobody reported issues, so they were not obvious until after 0.3.0 went out.

v0.3.0

v0.2.5

  • License has been correctly set to MIT instead of the "whatever" mentioned before.
  • Build targets for Windows x86, Windows x64, Linux x64, and OSX x64 have been added for packaging.
  • .NET Core 3.1 has been removed as a build version.
  • AppVeyor has been enabled to allow for easier testing of WIP builds.

v0.2.4

  • .NET 5 support has been dropped.
  • .NET 6 support (hashing and encrypt/decrypt) have been fixed.
  • Internal structure changed to be more library-oriented.

v0.2.3

  • Add support for outputting file hashes to a companion file.
  • Add support for alternate keyfile paths.
  • Add support for Citra aes_keys.txt.
  • Major internal cleanups and code separation.
  • Converted core library to .NET Standard 2.0.
  • Added .NET 6.0 as build target for main executable.

v0.2.2

  • Added a couple of fixes for NDS Prince of Persia carts that have mastering oddities.
  • Added the .ids iQue DS extension to matching.
  • Fixed the matching criteria for some of the NDS signatures.
  • Added more improperly decrypted empty secure area NDS signatures.
  • Remove forced pause at end of program run.
  • Make keys.bin only required for 3DS and New 3DS processing.
  • Add some try/catch blocks around processing so it doesn't hard crash (issue with incorrectly-named BIOS files).

v0.2.1

  • Merged two projects into one again, based on the Core version from last time. No changes to supported frameworks due to this.
  • Reorganized a bit of the code internally in case other cart types get supported in the future.
  • Added a couple of fixes for NDS Dragon Quest V carts that have mastering oddities.

v0.2.0

  • Internal cleanup of most of the code.
  • Removed .NET Framework 4.6.1 build.
  • Added .NET Framework 4.8, .NET Core 3.1, and .NET 5.0 builds.
  • Fixed NDS secure areas.
  • Fixed larger game carts.
  • Fixed encrypting N3DS carts.
  • Add force flags for NDS and N3DS.

Credits

  • Thanks to the developers of the original programs for doing the actual hard work to figure things out.
  • Also thanks to everyone who helped to test this against the original programs and made code suggestions.

Disclaimer: This program is only for use with personally dumped files and keys and is not meant for enabling illegal activity.

External links

Advertising: