From 1f257ecbb43ef08ae142f2b628819d327d066ee0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 4 Mar 2022 16:55:32 +0100 Subject: net.stun: Use util.strbitop Improves performance since the whole procedure is done in C --- net/stun.lua | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/net/stun.lua b/net/stun.lua index aefc4b27..688becc3 100644 --- a/net/stun.lua +++ b/net/stun.lua @@ -3,17 +3,7 @@ local hashes = require "util.hashes"; local net = require "util.net"; local random = require "util.random"; local struct = require "util.struct"; - ---- Private helpers - --- XORs a string with another string -local function sxor(x, y) - local r = {}; - for i = 1, #x do - r[i] = string.char(bit32.bxor(x:byte(i), y:byte(i))); - end - return table.concat(r); -end +local sxor = require"util.strbitop".sxor; --- Public helpers -- cgit v1.2.3