mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-07-06 14:50:35 +08:00
Add HaikuoCrypt (untested)
This commit is contained in:
@@ -2259,6 +2259,10 @@
|
|||||||
"ControlBlockName": "yomibito.bin",
|
"ControlBlockName": "yomibito.bin",
|
||||||
"Title": "黄泉ビト知ラズ~甘い雌蕊の性徴詩~"
|
"Title": "黄泉ビト知ラズ~甘い雌蕊の性徴詩~"
|
||||||
},
|
},
|
||||||
|
"Yotsunoha": {
|
||||||
|
"$type": "HaikuoCrypt",
|
||||||
|
"Title": "よつのは | 四叶草"
|
||||||
|
},
|
||||||
"your diary + H": {
|
"your diary + H": {
|
||||||
"$type": "SourireCrypt"
|
"$type": "SourireCrypt"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ enum CryptType {
|
|||||||
AkabeiCrypt {
|
AkabeiCrypt {
|
||||||
seed: u32,
|
seed: u32,
|
||||||
},
|
},
|
||||||
|
HaikuoCrypt,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
@@ -274,6 +275,7 @@ impl Schema {
|
|||||||
CryptType::SourireCrypt => Box::new(SourireCrypt::new(self.base.clone())),
|
CryptType::SourireCrypt => Box::new(SourireCrypt::new(self.base.clone())),
|
||||||
CryptType::HibikiCrypt => Box::new(HibikiCrypt::new(self.base.clone())),
|
CryptType::HibikiCrypt => Box::new(HibikiCrypt::new(self.base.clone())),
|
||||||
CryptType::AkabeiCrypt { seed } => Box::new(AkabeiCrypt::new(self.base.clone(), *seed)),
|
CryptType::AkabeiCrypt { seed } => Box::new(AkabeiCrypt::new(self.base.clone(), *seed)),
|
||||||
|
CryptType::HaikuoCrypt => Box::new(HaikuoCrypt::new(self.base.clone())),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1148,6 +1150,20 @@ impl<R: Read> Read for AkabeiCryptReader<R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seek_crypt_filehash_key_impl!(HaikuoCrypt, HaikuoCryptReader<T>);
|
||||||
|
|
||||||
|
impl<R: Read> Read for HaikuoCryptReader<R> {
|
||||||
|
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||||
|
let readed = self.inner.read(buf)?;
|
||||||
|
let key = (self.key ^ (self.key >> 8)) as u8;
|
||||||
|
for t in (&mut buf[..readed]).iter_mut() {
|
||||||
|
*t ^= key;
|
||||||
|
}
|
||||||
|
self.pos += readed as u64;
|
||||||
|
Ok(readed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_deserialize_crypt() {
|
fn test_deserialize_crypt() {
|
||||||
for (key, schema) in CRYPT_SCHEMA.iter() {
|
for (key, schema) in CRYPT_SCHEMA.iter() {
|
||||||
|
|||||||
Reference in New Issue
Block a user