From 440df8a06bb318724077229e376d11d64ca832bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Sun, 15 Sep 2024 16:20:54 +0100 Subject: [PATCH] [kwm] fix: KWMv1 key generation --- um_crypto/kuwo/src/kwm_v1.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/um_crypto/kuwo/src/kwm_v1.rs b/um_crypto/kuwo/src/kwm_v1.rs index cd51313..b530122 100644 --- a/um_crypto/kuwo/src/kwm_v1.rs +++ b/um_crypto/kuwo/src/kwm_v1.rs @@ -11,7 +11,10 @@ const KEY: [u8; 0x20] = [ impl CipherV1 { pub fn new(resource_id: u32) -> Self { let mut key = KEY; - for (k, r) in key.iter_mut().zip(resource_id.to_string().as_bytes()) { + for (k, r) in key + .iter_mut() + .zip(resource_id.to_string().as_bytes().iter().cycle()) + { *k ^= r; }