NdsForge.NET
1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsChecksums.cs
1
namespace
NdsForge
;
2
4
public
static
class
NdsChecksums
5
{
10
public
static
ushort
ComputeCrc16
(ReadOnlySpan<byte> data, ushort seed = ushort.MaxValue)
11
{
12
ushort crc = seed;
13
foreach
(
byte
value
in
data)
14
{
15
crc ^= value;
16
for
(
int
bit = 0; bit < 8; bit++)
17
{
18
crc = (ushort)(((crc & 1) == 0) ? crc >> 1 : (crc >> 1) ^ 0xA001);
19
}
20
}
21
22
return
crc;
23
}
24
}
25
NdsForge.NdsChecksums
Calculates checksums used by Nintendo DS image structures.
Definition
NdsChecksums.cs:5
NdsForge.NdsChecksums.ComputeCrc16
static ushort ComputeCrc16(ReadOnlySpan< byte > data, ushort seed=ushort.MaxValue)
Calculates the CRC-16 used by Nintendo DS headers and banners.
Definition
NdsChecksums.cs:10
NdsForge
Definition
NdsBanner.cs:5
src
NdsForge
Integrity
NdsChecksums.cs
Generated by
1.17.0