Applies the DSi AES-CTR transform with little-endian counter advancement. Encryption and decryption are the same operation; overloads support isolated buffers, arbitrary slices, and bounded caller-owned streams.
More...
|
| static byte[] | Transform (ReadOnlySpan< byte > data, NdsModcryptContext context, NdsModcryptArea area, long byteOffset=0) |
| | Transforms an independent buffer using one area from an immutable header-derived context.
|
| static byte[] | Transform (ReadOnlySpan< byte > data, ReadOnlySpan< byte > key, ReadOnlySpan< byte > initialCounter, long byteOffset=0) |
| | Transforms an independent buffer using explicit AES normal-key and initial-counter bytes.
|
| static async ValueTask | TransformAsync (Stream source, Stream destination, long length, NdsModcryptContext context, NdsModcryptArea area, long byteOffset=0, CancellationToken cancellationToken=default) |
| | Transforms exactly length bytes without closing either stream. If a late source truncation occurs, already completed chunks remain in the destination so callers can diagnose progress.
|
| static async ValueTask | TransformAsync (Stream source, Stream destination, long length, ReadOnlyMemory< byte > key, ReadOnlyMemory< byte > initialCounter, long byteOffset=0, CancellationToken cancellationToken=default) |
| | Transforms an exact stream interval with explicit normal-key and counter material. This overload is useful for tooling that obtains counters outside a parsed image while preserving bounded, allocation-stable I/O.
|
|
| const int | BlockSize = 16 |
| | Defines the AES-128 key, counter, and keystream block width imposed by the cartridge format.
|
Applies the DSi AES-CTR transform with little-endian counter advancement. Encryption and decryption are the same operation; overloads support isolated buffers, arbitrary slices, and bounded caller-owned streams.
Definition at line 9 of file NdsModcrypt.cs.
◆ Transform() [1/2]
Transforms an independent buffer using one area from an immutable header-derived context.
- Parameters
-
| data | Ciphertext or plaintext bytes beginning at byteOffset . |
| context | Resolved key material and HMAC-derived counters. |
| area | First or second modcrypt area. |
| byteOffset | Logical byte offset within that area, allowing correct unaligned slice processing. |
- Returns
- A new array; the input and context remain unchanged.
Definition at line 22 of file NdsModcrypt.cs.
◆ Transform() [2/2]
| byte[] NdsForge.NdsModcrypt.Transform |
( |
ReadOnlySpan< byte > | data, |
|
|
ReadOnlySpan< byte > | key, |
|
|
ReadOnlySpan< byte > | initialCounter, |
|
|
long | byteOffset = 0 ) |
|
inlinestatic |
Transforms an independent buffer using explicit AES normal-key and initial-counter bytes.
- Parameters
-
| data | Ciphertext or plaintext bytes beginning at byteOffset . |
| key | Exactly sixteen bytes containing a normal AES key. |
| initialCounter | Exactly sixteen bytes in DSi counter order. |
| byteOffset | Logical byte offset from the beginning of the encrypted area. |
- Returns
- A transformed copy suitable for encryption or decryption.
Definition at line 38 of file NdsModcrypt.cs.
◆ TransformAsync() [1/2]
| async ValueTask NdsForge.NdsModcrypt.TransformAsync |
( |
Stream | source, |
|
|
Stream | destination, |
|
|
long | length, |
|
|
NdsModcryptContext | context, |
|
|
NdsModcryptArea | area, |
|
|
long | byteOffset = 0, |
|
|
CancellationToken | cancellationToken = default ) |
|
inlinestatic |
Transforms exactly length bytes without closing either stream. If a late source truncation occurs, already completed chunks remain in the destination so callers can diagnose progress.
- Parameters
-
| source | Readable stream positioned at the requested area slice. |
| destination | Writable stream receiving the same number of transformed bytes. |
| length | Exact number of bytes to consume; trailing source bytes are left unread. |
| context | Resolved key material and both initial counters. |
| area | First or second modcrypt area. |
| byteOffset | Logical slice offset within the selected area. |
| cancellationToken | Cancels reads, cryptographic chunk processing, or writes. |
- Returns
- A task-like value that completes after exactly length bytes have been transformed.
Definition at line 63 of file NdsModcrypt.cs.
◆ TransformAsync() [2/2]
| async ValueTask NdsForge.NdsModcrypt.TransformAsync |
( |
Stream | source, |
|
|
Stream | destination, |
|
|
long | length, |
|
|
ReadOnlyMemory< byte > | key, |
|
|
ReadOnlyMemory< byte > | initialCounter, |
|
|
long | byteOffset = 0, |
|
|
CancellationToken | cancellationToken = default ) |
|
inlinestatic |
Transforms an exact stream interval with explicit normal-key and counter material. This overload is useful for tooling that obtains counters outside a parsed image while preserving bounded, allocation-stable I/O.
- Parameters
-
| source | Readable stream positioned at the requested encrypted or plaintext slice. |
| destination | Distinct writable stream receiving exactly length bytes. |
| length | Exact byte count; a shorter source raises EndOfStreamException. |
| key | Exactly sixteen bytes containing a normal AES key. |
| initialCounter | Exactly sixteen initial counter bytes. |
| byteOffset | Logical source position relative to the area's first byte. |
| cancellationToken | Cancels reads, cryptographic chunk processing, or writes. |
- Returns
- A task-like value that completes after exactly length bytes have been transformed.
Definition at line 95 of file NdsModcrypt.cs.
◆ BlockSize
| const int NdsForge.NdsModcrypt.BlockSize = 16 |
|
static |
Defines the AES-128 key, counter, and keystream block width imposed by the cartridge format.
Definition at line 12 of file NdsModcrypt.cs.
The documentation for this class was generated from the following file: