Add support to read int password from exe file

This commit is contained in:
2025-08-15 15:29:21 +08:00
parent 8f24b5aa02
commit bd9ba85687
9 changed files with 141 additions and 3 deletions

View File

@@ -269,6 +269,17 @@ impl<T: ByteOrder> Blowfish<T> {
[r, l]
}
/// Decrypts a block of data in-place.
pub fn decrypt_block(&self, buf: &mut [u8]) {
for i in 0..buf.len() / 8 {
let mut l = T::read_u32(&buf[i * 8..]);
let mut r = T::read_u32(&buf[i * 8 + 4..]);
[l, r] = self.decrypt([l, r]);
T::write_u32(&mut buf[i * 8..], l);
T::write_u32(&mut buf[i * 8 + 4..], r);
}
}
/// Creates a new Blowfish cipher instance with the given key.
pub fn new(key: &[u8]) -> Result<Self> {
if key.len() < 4 || key.len() > 56 {

View File

@@ -21,3 +21,6 @@ pub mod pcm;
#[cfg(feature = "utils-str")]
pub mod str;
pub mod struct_pack;
#[cfg(windows)]
pub use encoding_win::WinError;