# HG changeset patch # User Kim Alvefur # Date 1646409332 -3600 # Node ID f81488951f814f2d0445678f216b37b33324ce02 # Parent d77d8fba44ad7a12a19035a67338a8617619fdb9 net.stun: Use util.strbitop Improves performance since the whole procedure is done in C diff -r d77d8fba44ad -r f81488951f81 net/stun.lua --- a/net/stun.lua Mon Jun 28 03:56:45 2021 +0200 +++ b/net/stun.lua Fri Mar 04 16:55:32 2022 +0100 @@ -3,17 +3,7 @@ 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