Skip to content

Commit c44a3a6

Browse files
Fix 3DS hasher bug
1 parent ab4cb30 commit c44a3a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/BizHawk.Emulation.Common/N3DSHasher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace BizHawk.Emulation.Common
1919
/// As 3DS roms may be >= 2GiB, too large for a .NET array
2020
/// As such, we need to perform a quick hash to identify them
2121
/// For this purpose, we re-use RetroAchievement's hashing formula
22-
/// Note that we assume here a CIA isn't be hashed, but rather its installed file (identical hash anyways)
22+
/// Note that we assume here a CIA isn't being hashed, but rather its installed file (identical hash anyways)
2323
/// Reference code: https://github.com/RetroAchievements/rcheevos/blob/8d8ef920e253f1286464771e81ce4cf7f4358eee/src/rhash/hash.c#L1573-L2184
2424
/// </summary>
2525
public class N3DSHasher(byte[]? aesKeys, byte[]? seedDb)
@@ -353,7 +353,7 @@ private void HashNCCH(FileStream romFile, IncrementalHash md5Inc, byte[] header)
353353
{
354354
var ivCopy = new byte[iv.Length];
355355
iv.AsSpan().CopyTo(ivCopy);
356-
exeFsSectionOffset &= 0xFU;
356+
exeFsSectionOffset &= ~0xFU;
357357

358358
// First decrypt these last bytes using the secondary key
359359
AesCtrTransform(aes, iv, exeFsBuffer.AsSpan((int)exeFsSectionOffset, (int)(0x10 - (exeFsSectionSize & 0xF))));

0 commit comments

Comments
 (0)