mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-22 13:42:47 +00:00
Minor refactoring of TSC decryption [ci skip]
This commit is contained in:
parent
0ccbbefbed
commit
72a2ada0b2
|
@ -1,6 +1,6 @@
|
|||
pub fn decrypt_tsc(buf: &mut [u8]) {
|
||||
let half = buf.len() / 2;
|
||||
let key = if let Some(0) = buf.get(half) { 0xf9 } else { (-(*buf.get(half).unwrap() as isize)) as u8 };
|
||||
let key = if let Some(0) = buf.get(half) { 0x7 } else { *buf.get(half).unwrap() };
|
||||
log::info!("Decrypting TSC using key {:#x}", key);
|
||||
|
||||
for (idx, byte) in buf.iter_mut().enumerate() {
|
||||
|
@ -8,6 +8,6 @@ pub fn decrypt_tsc(buf: &mut [u8]) {
|
|||
continue;
|
||||
}
|
||||
|
||||
*byte = byte.wrapping_add(key);
|
||||
*byte = byte.wrapping_sub(key);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue