From 42b6f4331fd4ca9d4d40c8b7ed330a339b271d51 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 4 Feb 2022 17:12:05 +0100 Subject: [PATCH] http: websocket: avoid modulo for power of 2 even for the small cases this can matter Signed-off-by: Thomas Lamprecht --- proxmox-http/src/websocket/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox-http/src/websocket/mod.rs b/proxmox-http/src/websocket/mod.rs index 9c1f129c..95a6f513 100644 --- a/proxmox-http/src/websocket/mod.rs +++ b/proxmox-http/src/websocket/mod.rs @@ -114,7 +114,7 @@ fn mask_bytes(mask: Option<[u8; 4]>, data: &mut [u8]) { if data.len() < 32 { for i in 0..data.len() { - data[i] ^= mask[i % 4]; + data[i] ^= mask[i & 3]; } return; }