diff --git a/um_crypto/kuwo/src/des/mod.rs b/um_crypto/kuwo/src/des/mod.rs index 998fb0d..ad49e84 100644 --- a/um_crypto/kuwo/src/des/mod.rs +++ b/um_crypto/kuwo/src/des/mod.rs @@ -7,7 +7,7 @@ use core::{KuwoDes, Mode}; use umc_utils::base64; /// Decrypt string content -pub fn decrypt_ksing(data: &str, key: &[u8; 8]) -> Result { +pub fn decrypt_ksing>(data: T, key: &[u8; 8]) -> Result { let mut decoded = base64::decode(data)?; let des = KuwoDes::new(key, Mode::Decrypt); @@ -30,7 +30,7 @@ pub fn encrypt_ksing>(data: T, key: &[u8; 8]) -> Result { Ok(base64::encode(data)) } -pub fn decode_ekey(data: &str, key: &[u8; 8]) -> Result { +pub fn decode_ekey>(data: T, key: &[u8; 8]) -> Result { let decoded = decrypt_ksing(data, key)?; Ok(decoded[16..].to_string()) } diff --git a/um_crypto/kuwo/src/lib.rs b/um_crypto/kuwo/src/lib.rs index 1df2933..ef5affd 100644 --- a/um_crypto/kuwo/src/lib.rs +++ b/um_crypto/kuwo/src/lib.rs @@ -135,7 +135,7 @@ pub struct CipherBoDian(QMCv2Cipher); impl CipherBoDian { pub fn new>(ekey: T) -> Result { - let ekey = des::decode_ekey(&ekey, &SECRET_KEY)?; + let ekey = des::decode_ekey(ekey, &SECRET_KEY)?; let cipher = CipherV2::new_from_ekey(ekey.as_str())?; Ok(Self(cipher)) }