Changeset

12359:f81488951f81

net.stun: Use util.strbitop Improves performance since the whole procedure is done in C
author Kim Alvefur <zash@zash.se>
date Fri, 04 Mar 2022 16:55:32 +0100
parents 12358:d77d8fba44ad
children 12360:0801db678f5e
files net/stun.lua
diffstat 1 files changed, 1 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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