mirror of
https://git.um-react.app/um/lib_um_crypto_rust.git
synced 2026-03-07 20:19:51 +00:00
[kgm/ncm/kwm] refactor: improve performance for large file
This commit is contained in:
@@ -182,9 +182,8 @@ impl NCMFile {
|
||||
where
|
||||
T: AsMut<[u8]> + ?Sized,
|
||||
{
|
||||
let key_stream = self.audio_rc4_key_stream.iter().cycle().skip(offset & 0xff);
|
||||
for (datum, &key) in data.as_mut().iter_mut().zip(key_stream) {
|
||||
*datum ^= key;
|
||||
for (datum, offset) in data.as_mut().iter_mut().zip(offset..) {
|
||||
*datum ^= self.audio_rc4_key_stream[offset % self.audio_rc4_key_stream.len()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user