mirror of
https://github.com/NinjaCheetah/rustii.git
synced 2026-03-17 06:47:49 -04:00
Fixed content decryption, created base for real rustii CLI
rustii currently only supports unpacking WADs, with packing support being a work-in-progress.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// title/commonkeys.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
|
||||
const COMMON_KEY: &str = "ebe42a225e8593e448d9c5457381aaf7";
|
||||
const KOREAN_KEY: &str = "63b82bb4f4614e2e13f2fefbba4c9b7e";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/content.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/content.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
//
|
||||
// Implements content parsing and editing.
|
||||
|
||||
@@ -95,7 +95,8 @@ impl ContentRegion {
|
||||
pub fn get_content_by_index(&self, index: usize, title_key: [u8; 16]) -> Result<Vec<u8>, ContentError> {
|
||||
let content = self.get_enc_content_by_index(index)?;
|
||||
// Verify the hash of the decrypted content against its record.
|
||||
let content_dec = decrypt_content(&content, title_key, self.content_records[index].index);
|
||||
let mut content_dec = decrypt_content(&content, title_key, self.content_records[index].index);
|
||||
content_dec.resize(self.content_records[index].content_size as usize, 0);
|
||||
let mut hasher = Sha1::new();
|
||||
hasher.update(content_dec.clone());
|
||||
let result = hasher.finalize();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/crypto.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/crypto.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
//
|
||||
// Implements the common crypto functions required to handle Wii content encryption.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/mod.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/mod.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
|
||||
pub mod commonkeys;
|
||||
pub mod content;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/tik.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/tik.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
//
|
||||
// Implements the structures and methods required for Ticket parsing and editing.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/tmd.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/tmd.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
//
|
||||
// Implements the structures and methods required for TMD parsing and editing.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// title/wad.rs from rustii-lib (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii-lib
|
||||
// title/wad.rs from rustii (c) 2025 NinjaCheetah & Contributors
|
||||
// https://github.com/NinjaCheetah/rustii
|
||||
//
|
||||
// Implements the structures and methods required for WAD parsing and editing.
|
||||
|
||||
@@ -141,7 +141,7 @@ impl WAD {
|
||||
};
|
||||
Ok(wad)
|
||||
}
|
||||
|
||||
|
||||
pub fn to_bytes(&self) -> Result<Vec<u8>, WADError> {
|
||||
let mut buf = Vec::new();
|
||||
buf.write_u32::<BigEndian>(self.header.header_size).map_err(WADError::IOError)?;
|
||||
|
||||
Reference in New Issue
Block a user