Add HaikuoCrypt (untested)

This commit is contained in:
2026-04-10 13:30:11 +08:00
parent 1db58c6c53
commit 5b817b1899
2 changed files with 20 additions and 0 deletions

View File

@@ -2259,6 +2259,10 @@
"ControlBlockName": "yomibito.bin",
"Title": "黄泉ビト知ラズ~甘い雌蕊の性徴詩~"
},
"Yotsunoha": {
"$type": "HaikuoCrypt",
"Title": "よつのは | 四叶草"
},
"your diary + H": {
"$type": "SourireCrypt"
},

View File

@@ -175,6 +175,7 @@ enum CryptType {
AkabeiCrypt {
seed: u32,
},
HaikuoCrypt,
}
#[derive(Clone, Debug, Deserialize)]
@@ -274,6 +275,7 @@ impl Schema {
CryptType::SourireCrypt => Box::new(SourireCrypt::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::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]
fn test_deserialize_crypt() {
for (key, schema) in CRYPT_SCHEMA.iter() {