mirror of
https://github.com/aaru-dps/Aaru.Decoders.git
synced 2025-12-16 19:24:32 +00:00
Add method for unscrambling many DVD sectors at once (#8)
This commit is contained in:
committed by
GitHub
parent
6e0e9405ae
commit
e944d6b982
@@ -226,4 +226,18 @@ public sealed class Sector
|
||||
|
||||
return cipher == null ? sector : UnscrambleSector(sector, cipher);
|
||||
}
|
||||
|
||||
public byte[] Scramble(byte[] sector, uint transferLength)
|
||||
{
|
||||
byte[] scrambled = new byte[sector.Length];
|
||||
|
||||
if(sector.Length % 2064 != 0 ||
|
||||
sector.Length / 2064 != transferLength)
|
||||
return sector;
|
||||
|
||||
for(uint i = 0; i < transferLength; i++)
|
||||
Array.Copy(Scramble(sector.Skip((int)(i * 2064)).Take(2064).ToArray()), 0, scrambled, i * 2064, 2064);
|
||||
|
||||
return scrambled;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user